HAVE:
/* in yyyy-mm-dd format */
/* date1 is a macro variable within the program */
/* current value of date1 */
date1 = 2017-04-20
NEED:
date1 = '2017-04-20'
ATTEMPT:
/* Tried to put double quotes around it then replace it with single quotes, but this didn't work. */
data _null_;
set date1;
date1= quote(date1);
%put &date1
date1= %sysfunc (translate (&date1,%str(%"),%str(%')));
run;
Can someone tell me the place where I'm going wrong?
%let date1 = %unquote(%str(%'&date1%'));
It comes from a refined table (getdates) which only has one data value in its column (date1)
proc sql noprint;
select date
into :date1
from getdates;
quit;
proc sql noprint;
select quote(date, "'")
into :date1
from getdates;
quit;
Pass it with quotes in the value already then.
@unwanted_banana wrote:
It comes from a refined table (getdates) which only has one data value in its column (date1)
proc sql noprint;
select date
into :date1
from getdates;
quit;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.