BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Vigneswar
Obsidian | Level 7

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
karolis_b
Fluorite | Level 6

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

View solution in original post

5 REPLIES 5
RW9
Diamond | Level 26 RW9
Diamond | Level 26
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.
Vigneswar
Obsidian | Level 7
%let Business = %sysfunc(scan(Canada_all,1,'_'));

where scan(&output.,1,'_')

This output value is not specific to canada. It is dynamically changing getting resolved by an another macro &output.


Sorry for missing this!
karolis_b
Fluorite | Level 6

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

Vigneswar
Obsidian | Level 7
You are right. I missed . while referring Business. It worked now.

Thanks a lot Karolis!

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 5226 views
  • 2 likes
  • 4 in conversation