BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sebster24
Quartz | Level 8

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Jagadishkatam
Amethyst | Level 16

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;
Thanks,
Jag

View solution in original post

3 REPLIES 3
Jagadishkatam
Amethyst | Level 16

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;
Thanks,
Jag
ballardw
Super User

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;
Cynthia_sas
SAS Super FREQ

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:

not_stack.png

 

Each of those procedures will want the N and the Row Percent to have a separate column.

 

Cynthia

SAS Innovate 2025: Register Now

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!

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
  • 897 views
  • 0 likes
  • 4 in conversation