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

Hi Forum,

Could you please help me to figure out what is the wrong with my macro code below?

%macro one (product);

proc sort data= a.unified_dataset_&product out= A_&product_sorted;

   by bank_number account_number current_date;

run;

%mend one;

%one (product=PL);

%one (product=OD);

%one (product=MTG);

When I ran the above, following error message comes.

SYMBOLGEN:  Macro variable PRODUCT resolves to PL

WARNING: Apparent symbolic reference PRODUCT_SORTED not resolved.

NOTE 137-205: Line generated by the invoked macro "ONE".

21           proc sort data= a.unified_dataset_&product out= A_&product_sorted;    by bank_number account_number current_date; run;

                                                               _

                                                               22

ERROR 22-322: Syntax error, expecting one of the following: ;, (, ASCII, BUFFNO, DANISH, DATA, DATECOPY, DETAILS, DIAG, DUPOUT,

              EBCDIC, EQUALS, FINNISH, FORCE, IN, ISA, L, LEAVE, LIST, MESSAGE, MSG, NATIONAL, NODUP, NODUPKEY, NODUPKEYS,

              NODUPLICATE, NODUPLICATES, NODUPREC, NODUPRECS, NODUPS, NOEQUALS, NORWEGIAN, NOTHREADS, OSA, OUT, OVERWRITE,

              PAGESIZE, PRESORTED, PSIZE, REVERSE, SIZE, SORTSEQ, SORTSIZE, SORTWKNO, SWEDISH, T, TAGSORT, TECH, TECHNIQUE,

              TESTHSI, THREADS, WKNO, WORKNO. 

thanks

Mirisage

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User


out= A_&product_sorted;


SYMBOLGEN:  Macro variable PRODUCT resolves to PL

WARNING: Apparent symbolic reference PRODUCT_SORTED not resolved.




You've embedded the macro variable in the middle of text, so SAS doesn't know where the macro variable ends. It thinks that the macro variable is &product_sorted.

You can specify the end of a macro variable with a period.


out= A_&product._sorted;

View solution in original post

1 REPLY 1
Reeza
Super User


out= A_&product_sorted;


SYMBOLGEN:  Macro variable PRODUCT resolves to PL

WARNING: Apparent symbolic reference PRODUCT_SORTED not resolved.




You've embedded the macro variable in the middle of text, so SAS doesn't know where the macro variable ends. It thinks that the macro variable is &product_sorted.

You can specify the end of a macro variable with a period.


out= A_&product._sorted;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1 reply
  • 1120 views
  • 0 likes
  • 2 in conversation