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 a macro code that shows an error message in the log window.  Please let me know how to fix it.

PROC EXPORT DATA=underlyspecify&year.
      outfile="Underly_Con_&bdate..xlsx"
      dbms=xlsx replace;
      sheet=&year.; 
run; 
Spoiler
Spoiler

 sheet=&year;
NOTE: Line generated by the macro variable "YEAR".
1 1819
    ----
22
200
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string.

ERROR 200-322: The symbol is not recognized and will be ignored.

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

Hi @ybz12003  Perhaps enclose the &year in sheet within quotes?

 

sheet= "&year"

 

  sheet=&year.; 

 

 

View solution in original post

2 REPLIES 2
novinosrin
Tourmaline | Level 20

Hi @ybz12003  Perhaps enclose the &year in sheet within quotes?

 

sheet= "&year"

 

  sheet=&year.; 

 

 

japelin
Rhodochrosite | Level 12

The sheet name should be quoted as follows

sheet="&year."; 
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
  • 2 replies
  • 813 views
  • 1 like
  • 3 in conversation