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]

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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