BookmarkSubscribeRSS Feed
knveraraju91
Barite | Level 11

proc sort data=_final0 out=&OUTPUT_DATASET.(label=&dslbl); by &sortby; run; SYMBOLGEN: Macro variable OUTPUT_DATASET resolves to lptda.addili SYMBOLGEN: Macro variable DSLBL resolves to DILI Reporting Analysis Dataset (SI) NOTE 137-205: Line generated by the invoked macro "ADD0ATTRIBUTE". 1125 **sort output dataset then add label; proc sort data=_final0 out=&OUTPUT_DATASET.(label=&dslbl); - 22 1125! by &sortby; run; 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, NOUNIKEY, NOUNIKEYS, NOUNIQUEKEY, NOUNIQUEKEYS, NOUNIQUEREC, NOUNIQUERECS, NOUNIREC, NOUNIRECS, OSA, OUT, OVERWRITE, PAGESIZE, PRESORTED, PSIZE, REVERSE, SIZE, SORTSEQ, SORTSIZE, SORTWKNO, SWEDISH, T, TAGSORT, TECH, TECHNIQUE, TESTHSI, THREADS, UNIOUT, UNIQUEOUT, WKNO, WORKNO. NOTE: Line generated by the invoked macro "ADD0ATTRIBUTE". 1125 **sort output dataset then add label; proc sort data=_final0 out=&OUTPUT_DATASET.(label=&dslbl); - 200 1125! by &sortby; run; ERROR 200-322: The symbol is not recognized and will be ignored. SYMBOLGEN: Macro variable SORTBY resolves to USUBJID PARAMCD AEPOCH ADT MPRINT(ADD0ATTRIBUTE): proc sort data=_final0 out=lptda.addili(label=DILI Reporting Analysis Dataset (SI)) by USUBJID PARAMCD AEPOCH ADT ; MPRINT(ADD0ATTRIBUTE): run; NOTE: The SAS System stopped processing this step because of errors. WARNING: The data set LPTDA.ADDILI may be incomplete. When this step was stopped there were 0 observations and 0 variables. WARNING: Data set LPTDA.ADDILI was not replaced because this step was stopped. NOTE: PROCEDURE SORT used (Total process time): real time 2.40 seconds cpu time 0.01 seconds

Dear,

 

I am running a macro that has this    "proc sort data=_final0 out=&OUTPUT_DATASET.(label=&dslbl); by &sortby; run;"

The macro variables are resolving &OUTPUT_DATASET and &dslbl and &sortby   all are resolving. Below is the resolving code.  But I am getting errors because the semicolon is missing in resolved code after Label statement and before By statement eventhough there is semicolon in macro Label statement and before By statement. Please suggest. Thank you.  I am also copied the log file where it showing error (22). 

 

 

proc sort data=_final0 out=lptda.addili(label=DILI Reporting Analysis Dataset (SI)) by USUBJID
PARAMCD AEPOCH ADT ;
MPRINT(ADD0ATTRIBUTE): run;

3 REPLIES 3
noling
SAS Employee

Your label ends with a ")". Try using double quotes around your label macro:

 

(label="&dslbl");


Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF

View now: on-demand content for SAS users

ballardw
Super User

You also want to be very cautious about using *statement; style comments in macros.

Either use the %*statement ; or /* statement; */

 

Under some syntax combinations the statement style comment may be submitted as code to be treated as though it should be executed.

 

Astounding
PROC Star
Let's not forget the elephant in the room that leads to the problem.

PROC SORT works just fine. There's no good reason to turn it into a macro. All that accomplishes is adding complexity, clouding the debugging process, and eliminating the possibility of applying other options (such as NODUPKEY) .

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 919 views
  • 3 likes
  • 4 in conversation