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!

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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