From: SAS User on 8 Feb 2010 08:17 I am constructing a little dataset based on some variables using SQL but I am having a problem with inserting the data with the contents of a variable. This is what I have Test dataset created... %let testvar=XYZ; PROC SQL; insert into test; values ('test field text &testvar. '); quit; This .sas file is not a macro? Does it have to be to translate the contents of the variable as it does not at the moment? Thanks Lee
From: Tom Abernathy on 8 Feb 2010 08:42 Macro variables are not expanded inside of single quotes. Use double quotes. "test field text &testvar" On Feb 8, 8:17 am, SAS User <sasuser2...(a)googlemail.com> wrote: > I am constructing a little dataset based on some variables using SQL > but I am having a problem with inserting the data with the contents of > a variable. > > This is what I have > > Test dataset created... > > %let testvar=XYZ; > > PROC SQL; > insert into test; > values ('test field text &testvar. '); > quit; > > This .sas file is not a macro? Does it have to be to translate the > contents of the variable as it does not at the moment? > > Thanks > Lee
From: shiva on 8 Feb 2010 23:21 Hi Lee, Remove semicolon after test and try this.. %let testvar=XYZ; data test; input test $ 30.; cards; example ; run; PROC SQL; insert into test values ("test field text &testvar."); quit; Thanks, -Shiva
|
Pages: 1 Prev: How to solve this senario in datastep Next: SAS Connect issue. |