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

Hello,

When I create a macro parameter procedure, can a macro value be refered?

For example,

%let report=Monthly;
%let infile=monthly_TestReport_2017-9.xlsx;

 

%ReadXlsbd (inf=&infile., title=&report.);

when I do that, it does not work. Is possible anyway to solve that problem.

 

Thanks a lot,

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

@daisy6 wrote:

Hello,

When I create a macro parameter procedure, can a macro value be refered?

For example,

%let report=Monthly;
%let infile=monthly_TestReport_2017-9.xlsx;

 

%ReadXlsbd (inf=&infile., title=&report.);

when I do that, it does not work. Is possible anyway to solve that problem.

 


By any chance are you attempting to use the macro variable Report to place the text "Monthly" into the text of the Infile macro variable?

That would be

%let infile=&report._TestReport_2017-9.xlsx;

 

It really helps to show what you think you want to build given pieces as we are having to make lots of guesses.

 

View solution in original post

7 REPLIES 7
error_prone
Barite | Level 11
Not working? Post log with mprint and symbolgen active. I don't see a reason for not working.
Reeza
Super User

@daisy6 wrote:

 

when I do that, it does not work. 

 


What does 'not work' mean? 
Post your full code and log. 

 

Please use MPRINT and SYMBOLGEN to make sure the log has all the macro information. 

 

Basically, this works, so you're doing something wrong but you haven't provided enough information for us to tell you what it is.

 

%let test=one;
%let random = two;

%macro demo(var=);

%put "Macro Variable is " &var.;

%mend;

%demo(var=&test.);
%demo(var=&random.);

 

 

daisy6
Quartz | Level 8

I test my code again, and it works this time.

daisy6
Quartz | Level 8

Thanks for reply!

Patrick
Opal | Level 21

@daisy6

If using SAS EG or SAS Studio then make sure that your final test is done AFTER you've closed and re-opened your SAS session. This is to avoid that some "left-overs" allow you to run code which actually doesn't work in a fresh session. 

ballardw
Super User

@daisy6 wrote:

Hello,

When I create a macro parameter procedure, can a macro value be refered?

For example,

%let report=Monthly;
%let infile=monthly_TestReport_2017-9.xlsx;

 

%ReadXlsbd (inf=&infile., title=&report.);

when I do that, it does not work. Is possible anyway to solve that problem.

 


By any chance are you attempting to use the macro variable Report to place the text "Monthly" into the text of the Infile macro variable?

That would be

%let infile=&report._TestReport_2017-9.xlsx;

 

It really helps to show what you think you want to build given pieces as we are having to make lots of guesses.

 

daisy6
Quartz | Level 8

Thank you for reply. Ballardw

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 7 replies
  • 1254 views
  • 0 likes
  • 5 in conversation