BookmarkSubscribeRSS Feed
Ronein
Onyx | Level 15

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

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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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