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;

AI Navigator GIF.gif


Navigate AI governance with SAS tools for compliance and ethical AI practices. Try SAS Ai Navigator for free for the first six months.

Check it out on Microsoft Marketplace →

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