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 following macro program.   However, I got error message in Log.   Please help.   Thank you.

 

%let site1=PA;
%let site2=GA;
%let site3=OH; %macro format; %do i=1 %to 3; data RR_&&site&i._format; set RR_&&site&i; format caseid $9. County $50. consent $3.; run; %end; %mend; %format;

 

The error message was shown below.

 

MPRINT(FORMAT): ods rtf close;

SYMBOLGEN: && resolves to &.

SYMBOLGEN: Macro variable I resolves to 1

WARNING: Apparent symbolic reference SITE not resolved.

NOTE: Line generated by the macro variable "I".

1 RR_&site.1

                   -

                  22

                  200

MPRINT(FORMAT): data RR_&site.1_format;

SYMBOLGEN: && resolves to &.

SYMBOLGEN: Macro variable I resolves to 1

SYMBOLGEN: Macro variable SITE1 resolves to PA

MPRINT(FORMAT): set RR_;

MPRINT(FORMAT): format caseid $9.  County $50. consent $3.;

MPRINT(FORMAT): run;

ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, (, /, ;,

_DATA_, _LAST_, _NULL_.

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

1 ACCEPTED SOLUTION

Accepted Solutions
sidpesar
Obsidian | Level 7

Hi

can you try this by keeping 2 dots after i instead of 1 dot

RR_&&site&i.._format;

 

View solution in original post

4 REPLIES 4
sidpesar
Obsidian | Level 7

Hi

can you try this by keeping 2 dots after i instead of 1 dot

RR_&&site&i.._format;

 

ybz12003
Rhodochrosite | Level 12

Thanks, it works.

ballardw
Super User

 

 

If the purpose of this exercise is to add or change the formats for variables in a data set you might look at proc datasets instead. Changing formats is one of the things that procedure is designed for.

ybz12003
Rhodochrosite | Level 12

Thank you, Ballardw.    That was great suggestion.

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
  • 4 replies
  • 2195 views
  • 0 likes
  • 3 in conversation