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.
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.
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)); |
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 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.