In the past, the quote encapsulation rules were simple: single quotes blocked variable expansion, double quotes did not. Now, I can't figure out what is the correct method. For example, I have a script where I want to pass values on the command line using -sysparm "val1 val2 val3..." I read them in my script: %let var1=%scan(&sysparm,1) %let var2=%scan(&sysparm2) etc... I then use a variable in a sql statement: proc sql execute( select * from table where column=&var1; ) If I use either single or double quotes, I get an error that column val1 does not exist. (val1 is the value of variable var1). The behavior is inconsistent, it depends on the context where it occurs (for example, proc sql vs data vs a %macro definition) In order to get it to work, I have to do this proc sql execute( select * from table where column=%str(%'&var1%'); ) This is with sas 9.4. With previous versions this wasn't necessary and behavior was consistent. Sometimes quotes are interpreted as a delimiter, sometimes it is included in the variable value. sometimes it blocks variable expansion, sometimes not. Where is the behavior of variables and quotes defined? When are quotes required, when are they not?
... View more