ID | Survey | Survey_repeat | Day |
1 | A | 1 | 1 |
1 | A | 2 | 2 |
2 | A | 1 | 1 |
2 | A | 2 | 2 |
2 | A | 3 | 3 |
2 | A | 4 | 4 |
2 | A | 5 | 5 |
3 | A | 1 | 1 |
3 | A | 2 | 2 |
So, every participant completes a survey 5 times, one each day. I want to calculate how many are missing.
In this case, ID 1 and 3 have 3 surveys missing. How do I tally this?
@Reeza Thank you.
How do I approach the problem if there are multiple surveys.
/* UNTESTED CODE */
proc summary data=have nway;
class id;
var survey_repeat;
output out=_max_ max=survey_repeat_max;
run;
data want;
set _max_;
number missing = 5 - survey_repeat_max;
run;
If there can be multiple surveys, then use
class id survey;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.