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

data test;

input desc $;

datalines;

a1

a2

a3

a3

a2

a1

a1

a3

a2

a1

a3

a3

;

run;

 

proc freq data=test;

tables desc;

run;

 

Have:

desc Frequency Percent Cumulative
Frequency Cumulative
Percent
a1433.33433.33
a2325.00758.33
a3541.6712100.00

 

 

Want:

Summary
a1 a2a3
435
1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

There are going to be ways to do this in one step, but the two-step version is easy to understand:

 

proc freq data=test;

tables desc / noprint out=counts;

run;

 

proc tabulate data=counts;

class desc;

var count;

tables count, desc=' '*sum=' ';

title 'Summary';

run;

View solution in original post

1 REPLY 1
Astounding
PROC Star

There are going to be ways to do this in one step, but the two-step version is easy to understand:

 

proc freq data=test;

tables desc / noprint out=counts;

run;

 

proc tabulate data=counts;

class desc;

var count;

tables count, desc=' '*sum=' ';

title 'Summary';

run;

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 1 reply
  • 845 views
  • 0 likes
  • 2 in conversation