BookmarkSubscribeRSS Feed
ballardw
Super User

@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.

Reeza
Super User

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. 

 

 

j4sanford
Calcite | Level 5

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!

Ksharp
Super User

If I was right.

 

" a flag variable"

flag=catx('_', sex, age);

 

 

lsmestimate age / at=sex ;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 18 replies
  • 5967 views
  • 2 likes
  • 5 in conversation