BookmarkSubscribeRSS Feed
sonyk
Calcite | Level 5
Hi
I have a table of labtesting where i have the columns cardio ,Repiratory ,abdomen etc.How to find the frequncy and percent of values in those columns(under cardio i have NAD NS S1S2N).My resulting table shud look like the below.



N Percent
Cardio
NAD 5 25
Ns 10 30
S1S2N 5 25

Respiratory
Clear NVBS 5 25
NAD 10 30

Central Nervous System
Clinically N 12 45
NAD 5 35
1 REPLY 1
Cynthia_sas
Diamond | Level 26
Hi:
You did not say what you destination of choice was, or whether you wanted to see the report in one big table or in smaller tables (one for Cardio, one for Respiratory, etc).

It really depends on how you want the results to appear. These examples with SASHELP.SHOES can help you contrast the way the output looks with PROC TABULATE (one big table by default) versus PROC FREQ (a separate table for each variable by default).

cynthia
[pre]
ods listing close;
ods html file='c:\temp\use_tab_freq.html' style=sasweb;

proc tabulate data=sashelp.shoes;
title '1) TABULATE approach';
where region in ('Asia', 'Pacific','Canada') and
product in ('Sandal', 'Slipper');
class product region;
table product region,
n pctn;
keylabel n='Frequency'
pctn = 'Percent';
run;

proc freq data=sashelp.shoes;
title '2) FREQ approach';
where region in ('Asia', 'Pacific','Canada') and
product in ('Sandal', 'Slipper');
tables product region / nocum;
run;
ods html close;
[/pre]

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

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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