Hi All,
I have to figure out how to do a cumulative sum of all variables by row. Proc Means will sum each variable (column) but for all rows. I need to sum all columns (variables) by row.
I understand how to use BY or CLASS to group my output, but how do I sum all variables? I have a preset dataset, and I need to read from that and create a dataset that sums all variables.
Can you create a small example and show us what you want?
I think that the wording you used "how to do a cumulative sum of all variables by row" can be interpreted in two ways
Sure, ok.
I have a survey by participant (100 participants) which are my observation data (rows). Each survey has 20 questions.
I have some participant background info and 20 survey questions q1-q20. I need to add all the numbers that each participant gave for each question to create a score. If I were using excel, it would be SUM(B2:U2), with the next column storing the resulting total.
Does this help?
The format is basically:
ParticipantID Q1 Q2 Q3 Q4
1 2 3 4 2
2 1 1 2 1
The totals I need are by adding all question data per participant, or by row. Hence, participant 1 total would = 11 and participant 2 would = 5 .
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!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: