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 .
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.