12-10-2015 06:20 PM
I am writing several proc freq procedures and am wanting to store them output table in a file. I am specifying that I only want the frequency and the column percentage. However, when I open the table that is created (newdata) the percentage stored is the total frequency percentage not the column percentage. What am I doing wrong? The results tab shows what I am wanting in the frequency table.
Here is my code.......
proc freq data=mydata;
tables varA*varB/ out=newdata nopercent nocum norow;
But the table "newdata" is showing
varA varB Frequency Count Percent of Total Frequency
varA varB Frequency Count Column Percentage
12-10-2015 06:33 PM
You need to add OUTPCT to add the pct columns to the output data set, check the docs for details.
This is a bit of a roundabout way to get what you want, but easy enough. Someone else may have a better answer
proc freq data=sashelp.class; table age*sex/out=want(drop=pct_row) outpct norow nocum; run; proc print data=want; run;
12-10-2015 06:40 PM
This drops the row percentage. Thank you. How do I also get it to drop the percentage of frequency total? I tried adding pct_tabl but it did not work
12-11-2015 10:41 AM
If you want to use Proc Freq to generate multiple output sets from a single input dataset use multiple TABLE statements. Each table statement will only build one output data set.
Need further help from the community? Please ask a new question.