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,
@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 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.);
I test my code again, and it works this time.
Thanks for reply!
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.
@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.
Thank you for reply. Ballardw
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.