BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
NKormanik
Barite | Level 11
ods
html5
style=daisy
path="c:\0_SAS_1"
file="Long, Importance.htm";

proc sort data=sas_1.importance_long;
by Indicator;
run;

proc freq data=sas_1.importance_long;
tables Importance;
by Indicator;
run;

Please see above code.

 

In the tables which result from this Proc Freq, in the final row of each table, in the Cumulative Frequency column, one can find the TOTAL value for the specific BY Variable.

 

Presently I am interested in ONLY those TOTAL amounts.

 

Is there a more direct way?

 

Want just the TOTAL.Want just the TOTAL.

 

In the above pic, all I want is the Specific Indicator and the 161.

 

Any help greatly appreciated.

 

Nicholas Kormanik

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
yabwon
Amethyst | Level 16

How about:

proc sql;
  select Indicator, count(1) as total
  from sas_1.importance_long
  group by Indicator
  ;
quit;

?

 

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
Amethyst | Level 16

How about:

proc sql;
  select Indicator, count(1) as total
  from sas_1.importance_long
  group by Indicator
  ;
quit;

?

 

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



NKormanik
Barite | Level 11

Thanks @yabwon ,  @Astounding@Reeza .

 

All three approaches worked!

 

Astounding
PROC Star
Since you are somewhat familiar with PROC FREQ:

proc freq data = sas_1.importance_long;
tables indicator;
run;
Reeza
Super User
If the variable is numeric why not use PROC MEANS and the N (Number of non missing observations) as your statistic?

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
  • 4 replies
  • 1270 views
  • 4 likes
  • 4 in conversation