BookmarkSubscribeRSS Feed
Tomcaty
Obsidian | Level 7

Dear all,

 
I have a table shell that I need to generate from sample data set and thought SAS report writing Interface would be the best bet for the output I need. Normally, I use proc tabulate or proc report to generate this kind of output. But, I came to know that these procedures wont work for the table shell below. 
 
Attached please find the sample data set. 
 
 
data have;
input id sex$ race$ age agecat$;
datalines;
01 F W 66 60-70
02 F B 87 80-90
03 M W 63 60-70
04 M A 79 70-80
05 M W 75 70-80
06 M U 72 70-80
07 F W 66 60-70
08 F B 87 80-90
09 M W 63 60-70
10 M A 79 70-80
11 M W 75 70-80
12 M U 72 70-80
;
 
The table shell is below. Can I generate the exact table shell using the SAS RWI. If so, could you please provide the program to generate this table shell. 
 
 
DescriptivesOverall Cohort  Males Females 
Age       
 MeanStandard DeviationMeanStandard DeviationMeanStandard Deviation
 MinimumMaximumMinimumMaximumMinimumMaximum
 25% IQR75% IQR25% IQR75% IQR25% IQR75% IQR
Age Group      
60-70 yearsN%N%N%
70-80 yearsN%N%N%
80-90 yearsN%N%N%
 
Thank you very much for your help!
 
 
4 REPLIES 4
Cynthia_sas
SAS Super FREQ
Hi:
I'm not sure why you think that PROC REPORT won't work for this report. It might be that either REPORT or TABULATE would work for this report.

There are a lot of papers on the Report Writing Interface. Here are some of them:
“Using ODS Object Oriented Features To Produce a Formatted Record Layout” https://www.lexjansen.com/nesug/nesug08/bb/bb02.pdf
“Using the Data Step to Create Bar Charts: The ODS Report Writing Interface” Available at https://www.lexjansen.com/nesug/nesug10/bb/bb05.pdf
"That's All Right: More Complex Reports." http://support.sas.com/resources/papers/proceedings16/SAS5762-2016.pdf
“Next Generation Data _NULL_ Report Writing Using ODS OO Features” http://www2.sas.com/proceedings/sugi28/022-28.pdf
“ODS Report Writing Interface Makes Our Reporting Simple and Better” http://support.sas.com/resources/papers/proceedings12/071-2012.pdf
“Next Generation DATA _NULL_ Report Writing using ODS OO Features: A Powerful Tool to Create Custom Tables” http://support.sas.com/resources/papers/proceedings10/072-2010.pdf

But unless your data are not in the right structure, I don't see anything here that PROC REPORT could not do either.

Cynthia
ballardw
Super User

@Cynthia_sas

 

A previous post provided a "close" Proc Tabulate solution but apparently having two tables isn't quite what the OP wants.

I suggested an RWI approach may be possible but haven't the time or inclination at this point to try to cobble something that non-standard together as it was reminding me entirely too much of the programs with 400 PUT statements to put a dozen or so "tables" on a single page from many years ago.

Cynthia_sas
SAS Super FREQ
Hi:
Yes, I agree, I'm not inclined to find the interquartile range on the data that was posted because I'm not sure what procedure the OP is going to use to calculate that value and if I guess I could guess wrong.

But this layout is very similar to the type of report that I showed in my 2008 Creating Complex Reports paper, with the added benefit of having a separate column for the N and a separate column for the %, which makes generating the report much easier.

Cynthia
Reeza
Super User
It’s possible but the odds of getting someone to write the code for you is less likely. If you start you’ll probably get help but actually doing it all isn’t likely to happen. There’s a few consultants out there who would do it for a fee.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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