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

Hello,

I used the following SAS code to get cumulative count

 

proc freq data=have ;
tables pass2013/OUTCUM list missing out=want;
run;

 

then I used the following to sort by descending of cumulative count

 

proc sort data=want; by CUM_FREQ descending; run;

 

But got error message of "Variable NAME not found" as following


ERROR: Variable NAME not found.

ERROR 22-322: Syntax error, expecting one of the following: a name, _ALL_, _CHARACTER_, _CHAR_,
_NUMERIC_.

 

Please help.

 

thanks!

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
yabwon
Onyx | Level 15

Hi, 

 

read the doc about descending option:

 

proc sort data=want; 
by descending CUM_FREQ ; 
run

 

All the best

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



View solution in original post

4 REPLIES 4
yabwon
Onyx | Level 15

Hi, 

 

read the doc about descending option:

 

proc sort data=want; 
by descending CUM_FREQ ; 
run

 

All the best

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



superbug
Quartz | Level 8

@yabwon 

thanks much for the help!

ballardw
Super User

You may want to consider adding the option ORDER=FREQ to the Proc Freq. The output will be sorted by descending frequency of the variable. That is not exactly what your current output creates but it may be of interest.

superbug
Quartz | Level 8

@ballardw 

Thanks much for your suggestion!

I noticed this option before I posted.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

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
  • 4 replies
  • 1249 views
  • 0 likes
  • 3 in conversation