Hello everyone. I have a dataset called 'k.combined_dataset. I want to stratify sexual orientation (variable name 'so') by race/ethnicity and gender. See below of the desire product:
However, I was only able to create this:
by using this code:
/*Distribution of race by SO*/
proc sort data=k.combined_dataset;
by genderid so raceethnicity;
run;
title1 'Strata of Sexual Orientation by Gender & Race/ethnicity';
proc freq data=k.combined_dataset;
tables so*(raceethnicity genderid)/norow;
run;
Thanks!
Try PROC TABULATE
proc tabulate data=k.combined_dataset;
class so raceethnicity genderid;
table so, raceethnicity*genderid*(N COLPCTN);
run;
Try PROC TABULATE
proc tabulate data=k.combined_dataset;
class so raceethnicity genderid;
table so, raceethnicity*genderid*(N COLPCTN);
run;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.