Hi All,
How we on calculate scores from same observation without calculating total scores observation and by creating a new var named as Total_Score which has to match with total_score observation under Scores var in a ultimate way and without changing the order of the var and its values.
Pt_Id | Questions | Scores | Visit | Total_Score |
1 | Limitations Of Activities | 1 | 1 | |
1 | Moderate Activities | 1 | 1 | |
1 | Climbing Several Flights Of Stairs | 1 | 1 | |
1 | Bending, Kneeling, Or Stooping | 1 | 1 | |
1 | Walking More Than A Mile | 1 | 1 | |
1 | Walking Several Blocks | 0 | 1 | |
1 | Pain | 0 | 1 | |
1 | Total Score | 6 | 1 | 6 |
1 | Walking One Block | 1 | 1 | |
1 | Limitations Of Activities | 1 | 1 | |
2 | Moderate Activities | 1 | 2 | |
2 | Climbing Several Flights Of Stairs | 2 | 2 | |
2 | Bending, Kneeling, Or Stooping | 2 | 2 | |
2 | Walking More Than A Mile | 1 | 2 | |
2 | Walking Several Blocks | 1 | 2 | |
2 | Pain | 0 | 2 | |
2 | Total Score | 8 | 2 | 8 |
2 | Walking One Block | 1 | 2 |
Much thanks for help.
If I understand the question correctly, you can use:
data want;
set have;
if questions='Total Score' then
Total_Score = scores;
run;
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.