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;
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;
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.
Do I put lowest to highest instead of descending?
No. Just remove descending from BY statement. It will automatically sort from lowest to highest
There is no need to specify ascending, as it is the default sorting:
proc sort data=Bbq;
by Price;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.