ERROR: 22-322 SYNTAX ERROR, EXPECTING ONE OF THE FOLLOWING: A NAME, _ALL_, _CHARACTER_,

Reply
Frequent Contributor
Posts: 135

ERROR: 22-322 SYNTAX ERROR, EXPECTING ONE OF THE FOLLOWING: A NAME, _ALL_, _CHARACTER_,

        %LET DATE5 = 01JAN2018; /*CHANGED TO &DATE5 - THIS IS NOT BEING CALLED ANYWHERE IN THE PROGRAM*/
2538       
2539           *- CHANGED FOR 04/2011 RUN - USE ENROLLMENT CATEGORY CODE ONLY -*;
2540           *- CHANGED FOR 02/2012 RUN - SPLIT OUT TYA & TYA PRIME -*;
2541       
2542           *- KEEP TRS & TRR & TYA -*;
2543       
2544       
2545           DATA &NAME..ENR02 CHECK;
2546            LENGTH AREATYP $30. AREA $31. NETAREA $30.
2547                   ENRLTO $5. PLAN $15. STATUS $15.;
2548             SET ENROLL2;
2549              BY BENE EFFDATE DESCENDING; /*CAN TAKE OUT DESCENDING IF DO LAST.BENE*/
                                            _
                                            22
ERROR 22-322: Syntax error, expecting one of the following: a name, _ALL_, _CHARACTER_, _CHAR_, _NUMERIC_.  

2550       		IF FIRST.BENE; /*LOOKS AT THE MOST RECENT EFFDATE*/
Super User
Posts: 2,075

Re: ERROR: 22-322 SYNTAX ERROR, EXPECTING ONE OF THE FOLLOWING: A NAME, _ALL_, _CHARACTER_,

[ Edited ]

do you need something like?

 

BY BENE descending EFFDATE ; 

 instead of 

 

     BY BENE EFFDATE DESCENDING; 

 

I am assuming you want to output the last or max effdate record

 

 

Super User
Posts: 10,623

Re: ERROR: 22-322 SYNTAX ERROR, EXPECTING ONE OF THE FOLLOWING: A NAME, _ALL_, _CHARACTER_,

descending must come before a variable name. Reading the documentation of the by statement would have made that clear to you and prevented that simple mistake. Maxim 1 saves time.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Ask a Question
Discussion stats
  • 2 replies
  • 40 views
  • 0 likes
  • 3 in conversation