SAS Procedures

Help using Base SAS procedures
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-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 991 views
  • 0 likes
  • 2 in conversation