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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 792 views
  • 0 likes
  • 4 in conversation