Hello all, I'm working with SAS9.4. Can anyone explain why when using a string derived using CATS in a call to %nrquote, I get an error, but only when assigning the value to a macro variable via %LET? Strangely, if I replace the %LET with a %PUT, the code succeeds. Not sure if this is a bug or an expected behaviour. If you run the code below from EG you'll see what I mean. %let run_date= "31Jan2015:00:00:00"dt;
data _null_;
date=datepart(&run_date);
y=cats(year(date));
y2=cats('20','15');
y3=strip(year(date));
call symput('YEAR', y);
call symput('YEAR2', y2);
call symput('YEAR3', y3);
run;
/*fails*/
%let SYSLAST = %nrquote(DATASET_&YEAR);
%let SYSLAST = %nrquote(DATASET_&YEAR2);
/*succeeds*/
%let SYSLAST = %nrquote(DATASET_&YEAR3);
%put SYSLAST = %nrquote(DATASET_&YEAR3); The datastep is user-written precode to a DI job and the SYSLAST assignment is auto-generated. I was tasked with troubleshooting and resolving the issue. I got as far as understanding how to avoid the issue, but I can't explain the cause. All help is welcomed. Thanks, Ben
... View more