BookmarkSubscribeRSS Feed
ydathamaharushi
Calcite | Level 5

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_IdQuestionsScoresVisitTotal_Score
1Limitations Of Activities11 
1Moderate Activities11 
1Climbing Several Flights Of Stairs11 
1Bending, Kneeling, Or Stooping11 
1Walking More Than A Mile11 
1Walking Several Blocks01 
1Pain01 
1Total Score616
1Walking One Block11 
1Limitations Of Activities11 
2Moderate Activities12 
2Climbing Several Flights Of Stairs22 
2Bending, Kneeling, Or Stooping22 
2Walking More Than A Mile12 
2Walking Several Blocks12 
2Pain02 
2Total Score828
2Walking One Block12 

 

Much thanks for help.

3 REPLIES 3
Astounding
PROC Star

If I understand the question correctly, you can use:

data want;
set have;
if questions='Total Score' then
Total_Score = scores;
run;

ydathamaharushi
Calcite | Level 5
Not, I mean by addition/cumulative method - I need the all question scores in new variable under total score observation and it has to be match with the total score of the same, but not with directly assigning.

Thanks !
Astounding
PROC Star
You will need to explain what the program should count, to get the totals in your example.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

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