BookmarkSubscribeRSS Feed
Ronein
Meteorite | Level 14

Hello

I am using proc freq to calculate two way distribution.

I want to calculate only percentage from total.

I have some questions please:

1-In the printed output I see a row  "Total frequency". How can I delete this row? I want to show only percent ...

2-The percent is displayed without % symbol. How can I add it?

DATA auto ;
LENGTH make $ 20 ;
INPUT make $ 1-17 price mpg rep78 modtype ;
CARDS;
AMC Concord        4099 22 3 2
AMC Pacer          4749 17 3 2
Audi 5000          9690 17 5 3
Audi Fox           6295 23 3 1
BMW 320i           9735 25 4 1
Buick Century      4816 20 3 2
Buick Electra      7827 15 4 2
Buick LeSabre      5788 18 3 2
Cad. Eldorado     14500 14 2 3
Olds Starfire      4195 24 1 2
Olds Toronado     10371 16 3 2
Plym. Volare       4060 18 2 2
Pont. Catalina     5798 18 4 2
Pont. Firebird     4934 18 1 1
Pont. Grand Prix   5222 19 3 2
Pont. Le Mans      4723 19 3 1
;
RUN;


Title;
proc freq data=auto ; 
table modtype*make/missing norow  nocol  nofreq  ; 
run;

 

4 REPLIES 4
ChrisNZ
Tourmaline | Level 20

1-In the printed output I see a row  "Total frequency". How can I delete this row? 

The documentation is your friend.

 

2-The percent is displayed without % symbol. How can I add it?

This is not straight forward and requires that you customise the default output with proc template.

See

http://support.sas.com/resources/papers/freq92.pdf

https://www.lexjansen.com/nesug/nesug06/po/po09.pdf

 

Ronein
Meteorite | Level 14

Thank you.

I still didn't find solution to "How to remove total frequency row"

 

Astounding
PROC Star
One approach that could handle both questions: switch from PROC FREQ to PROC TABULATE. However, there is definitely a learning curve involved.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 606 views
  • 1 like
  • 4 in conversation