@j4sanford wrote:
So I am a novice at SAS computations, yet have managed to run most of my statistics no problem until now; I have encountered interaction effects in my analysis. I am utilizing a weighted dataset and was told I need to create flag variables to stratify my data for sex and race. Hoping someone here can help me know how the coding should look? It also has a PSU, and a Stratum variable on top of the weight variable. I have no idea how to create flag variables though. I am also using logistic regression so I need to know how to create the flag variable and then run a logistic regression so that I can get odds ratios for each stratified varible(sex, and all the different races). If this helps I am also utilizing the CDC's YRBS, which is a free dataset available to all, if anyone here feels so inclined to attempt on their own.
YRBS requires use of something that can handle a complex sample since it is a multistage cluster sample. Proc Surveylogistic would be the tool I would grab first. Place the variables that you think you need dummy variables for on the CLASS statement. The dummies will be built internally when those class variables on the Model statement (assuming they are in the independent part of the statment), no need for additional variables in the data set. Note that a format applied to the class variables can be used to get different analyis groups.
My bad, PROC SURVEYLOGISTIC doesn't support an ODDSRATIO statement, you'll likely need an ESTIMATE statement instead.
I think your original question has been answered though, this is a new, different, question that would be best posted under Statistical Procedures Forum.
yes! I was told an LSMestimate or a flag variable is what I need, but I dont know how to do this. A new thread has been submitted, if you figure out a way to do this please share thank you!
If I was right.
" a flag variable"
flag=catx('_', sex, age);
lsmestimate age / at=sex ;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.