BookmarkSubscribeRSS Feed
toneill
Calcite | Level 5

I have two variables; the second dependent upon the answer of the first. There are 5 variables (Q1) each with its own severity scale (Q2).

Q1. Do you have the symptom? y/n/don't know/refused (1/2/88/99)

--> If a participant answered Y(1) to Q1, they should go to Q2.

Q2. Severity: 1/2/3/4/88/99

I would like to make a data set with no inappropriate missing data (where 'missing'=./don't know/refused).

So far, I have been able to subset my data for Q1:

data newdata;

     set olddata;

     if cmiss (of var1 var2 var3 var4 var5) then delete;

run;

This worked well and the expected number of observations were removed. However, I am unsure of how to move forward. If I ask SAS to remove the missing observations from Q2, then all those that answered N(2) to Q1 (and therefore, have appropriately missing data in Q2) would be removed. I only want to remove those individuals who answered Y(1) to Q1 and subsequently have missing data for Q2 (Q2 is conditioned on Q1).

Any direction would be appreciated.

1 REPLY 1
stat_sas
Ammonite | Level 13

How about this

data want;

     set newdata;

     if q1=1 and q2 in (88,99) then delete;

run;

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1 reply
  • 673 views
  • 0 likes
  • 2 in conversation