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
Onyx | Level 15

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
Onyx | Level 15

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?

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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