BookmarkSubscribeRSS Feed
araren
Calcite | Level 5

Hi!

 

Its' the been awake for more than 24hours newbie. Back with another question, I would greatly appreciate the help :'(

 

I need help making a table of summary statistics, and I need to stratify that table with a categorical variable. The categorical variable is hospital stay, and in my dataset I have data for hospital admission date, and hospital discharge date. 

 

I know how to make a means table for all variables and a univariate table, but I don't know how to put them all together, and I don't know how to future stratify it by that categorical variable. Please help 😞

Screen Shot 2020-11-16 at 4.49.42 AM.pngScreen Shot 2020-11-16 at 4.45.47 AM.pngScreen Shot 2020-11-16 at 4.45.34 AM.png

 

I've attached photos of what my table is supposed to look like, and my data.

 

Thank you 😞

 

edit: To add code. the reason I didn't in the first place was because I was entirely unsure of what code to use....

To create a stratified table, this is what I think to use:

 

proc freq data = dataset;
by stratifying_variable;
table variable2;
run;

However, I don't know how to adjust this so that i get a summary statistics table for all of the variables in my set. 

3 REPLIES 3
PaigeMiller
Diamond | Level 26

you will get a faster response if you post your data as provided by these instructions, and not as a screen capture.

--
Paige Miller
araren
Calcite | Level 5
Have edited with code. Not quite sure of what code to use even, hence the screencaps.
Reeza
Super User

Run this macro once for each group subset and then merge the results together is your quickest way.

https://communities.sas.com/t5/SAS-Communities-Library/Demographic-Table-and-Subgroup-Summary-Macro-...

 

 

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!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 454 views
  • 0 likes
  • 3 in conversation