Hello,
I am currently trying to create a proc freq equivalent in proc report.
For example:: the proc freq version is as follows::
proc freq data=sashelp.shoes ;
tables region * product/ nocol nocum nopercent;
run;
i wrote the following proc report version, but it does not look like the cross table created by proc freq.
For example:: the row percentages are missing.
proc report data=sashelp.shoes;
column region product n pctn;
define region /group order=internal;
define product /group ;
define n / 'Frequency';
define pctn / 'Percent' across f=percent9.2;
rbreak after/ summarize style=Header;
compute after;
region="Total";
endcomp;
run;
Any help?
Thank you.
please do not mention the across in define PCTN
proc report data=sashelp.shoes;
column region product n pctn;
define region /group order=internal;
define product /group ;
define n / 'Frequency';
define pctn / 'Percent' f=percent9.2;
rbreak after/ summarize style=Header;
compute after;
region="Total";
endcomp;
run;
please do not mention the across in define PCTN
proc report data=sashelp.shoes;
column region product n pctn;
define region /group order=internal;
define product /group ;
define n / 'Frequency';
define pctn / 'Percent' f=percent9.2;
rbreak after/ summarize style=Header;
compute after;
region="Total";
endcomp;
run;
If you want it to look exactly like Proc Freq then use proc freq.
Or maybe a different procedure.
proc tabulate data=sashelp.shoes; class region product; table region , (product all='Region Total')*(n pctn rowpctn colpctn) ; run;
Hi:
I agree -- if you need the cross-tab table to look like PROC FREQ, it is the only procedure that will stack the values in cells as you show.
Neither PROC TABULATE nor PROC REPORT will stack the values, although you could get a cross-tab from either procedure, as shown below:
Each of those procedures will want the N and the Row Percent to have a separate column.
Cynthia
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.