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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

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