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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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