Hi,
I am trying to create a file name Canada_CM_ Jan_28_2019 .
File is basically extracting the Business name with monday's date of the week.
Below is my code,
%let t=%sysfunc(today());
%let monday=%sysfunc(intnx(week.2,&t,0,b),date9.);
%let outputdate=%substr(&monday,3,3)_%substr(&monday,1,2)_%substr(&monday,6);
%put &outputdate;
%let Business = %sysfunc(scan(Canada_all,1,'_'));
%put &Business;
%let file = %qsysfunc(&Business_CM_ &outputdate);
%put &file;
When run the code I am getting the below error,
WARNING: Apparent symbolic reference BUSINESS_CM_ not resolved.
ERROR: Function name missing in %SYSFUNC or %QSYSFUNC macro function reference.
Any suggestions.
Thanks,
Vigneswar
Hi!
It tries to resolve Business_CM macro variable, but you haven't declared it. I'm guessing, you are trying to resolve &Business followed by _CM_ and then date. Try code below. I added . after &Business, also I have changed %sysfunc(scan()) to %scan.
%let t=%sysfunc(today());
%let monday=%sysfunc(intnx(week.2,&t,0,b),date9.);
%let outputdate=%substr(&monday,3,3)_%substr(&monday,1,2)_%substr(&monday,6);
%put &outputdate;
%let Business = %scan(Canada_all,1,_);
%put &Business;
%let file = &Business._CM_&outputdate;
%put &file;
- Karolis
data _null_; want=cats("Canada_CM_",put(month(today()),monname3.),put(day(today(),best.),put(year(today()),best.));
call symputx('file',want); run;
Note not tested, but something like that.
Hi!
It tries to resolve Business_CM macro variable, but you haven't declared it. I'm guessing, you are trying to resolve &Business followed by _CM_ and then date. Try code below. I added . after &Business, also I have changed %sysfunc(scan()) to %scan.
%let t=%sysfunc(today());
%let monday=%sysfunc(intnx(week.2,&t,0,b),date9.);
%let outputdate=%substr(&monday,3,3)_%substr(&monday,1,2)_%substr(&monday,6);
%put &outputdate;
%let Business = %scan(Canada_all,1,_);
%put &Business;
%let file = &Business._CM_&outputdate;
%put &file;
- Karolis
See Maxim 48. Always terminate macro variable references with a dot (&Business.).
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.