I have this section of code in SAS to convert 1 variable of a 5 point likert scale into numeric:

data Cal_1;

set d1;

if Cal_1 = 'Strongly Disagree' then Cl_1 = 1;

else if Cal_1 = 'Disagree' then Cl_1 = 2;

else if Cal_1 = 'Neutral' then Cl_1 = 3;

else if Cal_1 = 'Agree' then Cl_1 = 4;

else if Cal_1 = 'Strongly Agree' then Cl_1 = 5;

keep seq Cal_1 Cl_1;

run;

Where Cal_1 is the reference and Cl_1 will hold the value, is there a way to implement this into a loop so that I could do the same to Cal_2 until Cal_20? Any leads would be appreciated.

More Juliano Jr Salmasan Parena's questions See All
Similar questions and discussions