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 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 779 views
  • 0 likes
  • 2 in conversation