Hi Everyone, I have this survey data that includes checkboxes (select all that apply), and I am trying to create a new variable that groups all of these separate variables into a new variable. An individual can check more than one role or facility. I am new with SAS, and I know using "Else if" would not give the right frequencies (since its for mutually exclusive responses). Initially, I was going to use macro since I had a lot of variables to recategorize, but I couldn't get it to work so I decided to go with this but still not getting the right frequencies for each category. Can anyone help correct the code below, and let me know what I might be doing wrong thank you? SAS 9.4 *creating a new category called "respondent's role"*; Data FSurvey1; set FSurvey; if respondent_role___1= 1 then role=1; if respondent_role___2= 1 then role=2; if respondent_role___3= 1 then role=3; if respondent_role___4= 1 then role=4; if respondent_role___5= 1 then role=5; if respondent_role___6= 1 then role=6; if respondent_role___7= 1 then role=7; if respondent_role___8= 1 then role=8; *creating a new category called "facilities description"*; if facility_description___1= 1 then facility=1; if facility_description___2= 1 then facility=2; if facility_description___3= 1 then facility=3; if facility_description___4= 1 then facility=4; if facility_description___5= 1 then facility=5; if facility_description___6= 1 then facility=6; if facility_description___7= 1 then facility=7; if facility_description___8= 1 then facility=8; format facility facility. role role.; run; proc freq data= FSurvey1; tables facility role; run;
... View more