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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 808 views
  • 0 likes
  • 2 in conversation