BookmarkSubscribeRSS Feed
mpajoh
Fluorite | Level 6
Is there procedure that calculates percentages and creates an output data set, like "proc tabulate" does for reports.

Thanks;
Masoud
3 REPLIES 3
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Look at PROC MEANS, and possibly using a BY statement with your variable list.

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search argument, this topic / post:

proc calculate percentage site:sas.com Message was edited by: sbb
Cynthia_sas
SAS Super FREQ
Hi:
Although PROC FREQ will create an output dataset with percentages, is there a reason you don't want to use PROC TABULATE to calculate percentages??? For example, the program below:
[pre]
proc freq data=sashelp.class;
tables age/out=work.frqage;
run;

ods listing;
proc print data=work.frqage;
title 'Data set created by PROC FREQ';
run;

proc tabulate data=sashelp.class
out=work.tabage(rename=(N=Count PCTN_0=Percent));
class age;
table age,
n pctn;
run;

proc print data=work.tabage;
title 'Data set created by PROC TABULATE';
title2 'You can drop or ignore _TYPE_, _TABLE_ and _PAGE_';
run;

title;
[/pre]

generates the same results as shown at the bottom of this post.

cynthia
[pre]
PROC FREQ output dataset:
Data set created by PROC FREQ

Obs Age COUNT PERCENT
1 11 2 10.5263
2 12 5 26.3158
3 13 3 15.7895
4 14 4 21.0526
5 15 4 21.0526
6 16 1 5.2632

------------------------------------------------------------

PROC TABULATE output dataset:
Data set created by PROC TABULATE
You can drop or ignore _TYPE_, _TABLE_ and _PAGE_

Obs Age _TYPE_ _PAGE_ _TABLE_ Count Percent
1 11 1 1 1 2 10.5263
2 12 1 1 1 5 26.3158
3 13 1 1 1 3 15.7895
4 14 1 1 1 4 21.0526
5 15 1 1 1 4 21.0526
6 16 1 1 1 1 5.2632

[/pre]
mpajoh
Fluorite | Level 6
Thanks you all for suggestions.

Masoud

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 3 replies
  • 1028 views
  • 0 likes
  • 3 in conversation