05-03-2016 05:36 PM - last edited on 05-03-2016 07:51 PM by Reeza
If I have a macro variable and I would like to put quotation marks around it, is there a function to do this?
Have: %let ppl= 001-001 001-002;
Want: "001-001" "001-002"
05-03-2016 05:40 PM
I think you mean quotes.
Are you you creatimg this manually? How do you plan to use it? There are ways but not easily so sometimes easier to do depending on how you create macro variable or how you plan to use it.
05-03-2016 06:11 PM
Thanks Reeza for your response. I am using it as follows:
select distinct subject into pl separated by ' '
where foldername = "Early Study Withdrawal";
proc print data=opt.sv(where=(subject = &ppl));
var subject folder svdtc;
ERROR: WHERE clause operator requires compatible variables.
05-03-2016 07:21 PM
I think you may want something like
proc sql; select distinct quote(strip(subject)) into :ppl separated by ' ' from opt.sv where foldername = "Early Study Withdrawal"; quit; proc print data=opt.sv(where=(subject in( &ppl))); var subject folder svdtc; run;
The strip is to remove trailing blanks within the quotes which might cause issues with the comparison
And you didn't want to test if subject was equal to a list of values but a member of the list.
05-04-2016 02:43 PM
07-27-2016 05:49 AM
just a small suggestion , when comparing text variable making them into same case, this will help resolve mis-match due to case inconsistency in the data..
Hope that helps