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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.