BookmarkSubscribeRSS Feed
harveysarah0
Calcite | Level 5

76 PROC SORT Bbq;
---
22
202
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.
ERROR 202-322: The option or parameter is not recognized and will be ignored.
77 By descending Price
78 RUN;

 

 

This comes up when I am trying to answer this question. 

Sort your merged SAS data set by price of a quarter rack of ribs, from cheapest to

most expensive. Print the resulting table and present it (properly titled) in your

solutions.

 

This is the code I am trying to input:

PROC SORT Bbq;
By descending Price
RUN;

 

5 REPLIES 5
Patrick
Opal | Level 21

Look at the code you've posted in your other post here. That should work.

Valid syntax would be:

 

PROC SORT data=Bbq;
By descending Price;
RUN;

Astounding
PROC Star

One more change to make:  take out the word DESCENDING.

 

The problem asks for cheapest to most expensive, which would require lowest to highest price.

 

You won't get an error by adding DESCENDING, but you won't get the right result.

harveysarah0
Calcite | Level 5

Do I put lowest to highest instead of descending?

V_27
Obsidian | Level 7

No. Just remove descending from BY statement. It will automatically sort from lowest to highest

ed_sas_member
Meteorite | Level 14

Hi @harveysarah0 

 

There is no need to specify ascending, as it is the default sorting:

proc sort data=Bbq;
	by Price;
run;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 5 replies
  • 1101 views
  • 0 likes
  • 5 in conversation