BookmarkSubscribeRSS Feed
Sofia2022
Fluorite | Level 6

Hi all,

 

Students where requested to complete a survey but some students didn't answer all the questions (Question1 to Question12). The survey consist of 12 questions.  I want to create a variable  to flag ( variable name: complete)  students that didn't answer three or more questions from the survey. 

 

The questions that are not answered are coded as missing  "."  

 

The variable names for the questions are question1 = item1, question2= item2,  question3= item3 etc. 

 

For example,

  • if a student answered more than 10 questions then complete=1
  • If a student answered only 5 questions then complete = 0
  • If a student answered only 11 questions then complete = 1
  • If a student answered only 9 questions then complete = 0

 

Appreciate your assistance in writing up the sas code. Through array?

 

Thanks,

Sofia 

 

 

 

 

 

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

Obviously, this is untested, since I can't see your data

 

data want;
   set have;
   complete = (n(of item:) > 9);
run;
andreas_lds
Jade | Level 19

And what should happen if exactly 10 answers are correct?

Posting data in usable form helps us to provide tested code.

sas-innovate-2024.png

 

Secure your spot at the must-attend AI and analytics event of 2024: SAS Innovate 2024! Get ready for a jam-packed agenda featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events.

 

Register by March 1 to snag the Early Bird rate of just $695! Don't miss out on this exclusive offer. 

 

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
  • 2 replies
  • 264 views
  • 2 likes
  • 3 in conversation