Please, anyone, tell me how to use the reverse function or if there is an alternative way to reverse the Value in a numeric Variable.
The survey questions were measured on a scale of 0 (least) to 3 (most).
However, the data were recorded inconsistently by data entry clerks; and questions 2, 3, and 5 (for every visit) were accidentally recorded in the reverse order (0=most and 3=least). Convert questions 2, 3, and 5 for every visit so that they are measured in the same direction as the other questions.
What I did is using
data surveyB;
set survey_1;
backward=reverse('Q3');
put backward=;
run;
proc print data = surveyB; run;
Simple math will do this. Let's see, you want them to be 0 (least) and 3 (most), but some questions have 3 (least) and 0 (most), then for those questions something like this:
correct_score = -score + 3;
Simple math will do this. Let's see, you want them to be 0 (least) and 3 (most), but some questions have 3 (least) and 0 (most), then for those questions something like this:
correct_score = -score + 3;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.