Hi, need help!!
when assigning macro to proc export, it works in data file i.e Reach_Report_&export but not in outfile. My macro contains value as 2, it works in data = Reach_Report_2 but not in outfile. Any reasons and how to correct it?
proc export data=Report_2 outfile='\C:\Users\Incremental_Reach_Report_&export.xlsx'
dbms = xlsx replace;run;
When using single quotes ' then SAS will not look to find macro references inside. You have to use double quotes for it to happen.
Oh, and you will probably need to add another dot in there.
Example:
%let export=myFile;
%put \C:\Users\Incremental_Reach_Report_&export.xlsx;
*This will then be translated to \C:\Users\Incremental_Reach_Report_myFilexlsx;
*The dot will be translated as the end of the macro variable, and it will be removed when the replacement is happening.;
*You want;
%put \C:\Users\Incremental_Reach_Report_&export..xlsx;
*This will then be translated to \C:\Users\Incremental_Reach_Report_myFile.xlsx;
When using single quotes ' then SAS will not look to find macro references inside. You have to use double quotes for it to happen.
Oh, and you will probably need to add another dot in there.
Example:
%let export=myFile;
%put \C:\Users\Incremental_Reach_Report_&export.xlsx;
*This will then be translated to \C:\Users\Incremental_Reach_Report_myFilexlsx;
*The dot will be translated as the end of the macro variable, and it will be removed when the replacement is happening.;
*You want;
%put \C:\Users\Incremental_Reach_Report_&export..xlsx;
*This will then be translated to \C:\Users\Incremental_Reach_Report_myFile.xlsx;
thank you, it helps
thank you !! it helps
Nearly 200 sessions are now available on demand in the Innovate Hub.
Watch Now →SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.