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

Hello:

 

I have the follow macro program. I found the ‘&&state.may.xlsx’ could not be translated to ‘MDmay.xlsx’ during procedure. I have tried ‘&state.may.xlsx’ too, it still didn’t work. Please help, thanks.

 

%let State=MD;

%let folder='\\abc.org\HHE\SAS\report\SASfiles\&&state.may.xlsx';

 

%macro export;

 

%mend;

 

 

option symbolgen mprint;

 

%include"\\abc.org\HHE\SAS\report\SASfiles\ExportMacro.sas" / lrecl=32767 source2;

 

%export

 

SYMBOLGEN: && resolves to &.

SYMBOLGEN: Macro variable I resolves to 21

SYMBOLGEN: Macro variable X21 resolves to Settings

SYMBOLGEN: Macro variable FOLDER resolves to

'\\abc.org\HHE\SAS\report\SASfiles\&&state.may.xlsx'

MPRINT(EXPORT): PROC EXPORT DATA= Settings

outfile='\\abc.org\HHE\SAS\report\SASfiles\&&state.may.xlsx' dbms=xlsx

replace;

MPRINT(EXPORT): WXLX;

SYMBOLGEN: && resolves to &.

SYMBOLGEN: Macro variable I resolves to 21

SYMBOLGEN: Macro variable X21 resolves to tblSettings

MPRINT(EXPORT): sheet= Settings;

MPRINT(EXPORT): run;

NOTE: The export data set has 384 observations and 2 variables.

NOTE: "\\abc.org\HHE\SAS\report\SASfiles\&&state.may.xlsx" file was

successfully created.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

You need double quotes for macro variables to resolve.

View solution in original post

2 REPLIES 2
Reeza
Super User

You need double quotes for macro variables to resolve.

ybz12003
Rhodochrosite | Level 12

Great, it works!  Thank you so much!

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
  • 2 replies
  • 370 views
  • 0 likes
  • 2 in conversation