BookmarkSubscribeRSS Feed
Bal23
Lapis Lazuli | Level 10

I need to generate a complicated table regarding race, age group, education and their scores. I need to do analysis first. So usually I would use sas to generate output and copy and paste in excel, and then present in a powerpoint or excel or word document.

I know someone can directly use SAS to do that, I would like to get advice from you if you can do that

 

if you need a sample data set, I have attached one. So previoulsy I need to generate five tables and then do copy and paste into one single table. If anyone can help to genearte the big table using SAS, please share.

 Thanks.

4 REPLIES 4
Cynthia_sas
SAS Super FREQ
Hi: I'm not sure what you posted. It has an OBS column -- so is this your desired report? What code have you tried? You said that "usually I would use SAS to generate output and copy and paste in excel" -- so that means you have some kind of SAS code that you are starting with. Can you post that code and a sample of your data or use one of the SASHELP datasets to illustrate your question.

cynthia
Reeza
Super User

Search LexJansen.com for sample code for either 'demographic' table or clinical reports. Your output looks similar though its hard to tell what you're actually trying to do. 

 

SAS is capable of creating very complex reports, but its not necessarily easy to do. 

 

It looks like just a big count table, so I have some code here that shows how to generate this in one table:

 

https://gist.github.com/statgeek/b308ac2cfc9b4db0ee3d793567627af0

 

There's a worked example at the end that shows how to use the macro. 

 

 

 

Bal23
Lapis Lazuli | Level 10

Thank you.  If I want to calculate realtive risk and 95%Ci instead of chisq, how and where I should replace, using your code as a template?

 

 

table &varcross/chisq out=temp1;

 

ods output OneWayChiSq=chisq;

 

run;

   
 

data temp2;

 

 

set chisq (where=(Statistic="Chi-Square") keep=prob statistic rename=(prob=chisq));

Reeza
Super User

Yes, you can change the ODS output to capture the data required and to report that instead. 

 

If you're making changes, I suggest making one change, check if it works and then go forward step by step to change it to what you need.

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
  • 685 views
  • 0 likes
  • 3 in conversation