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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.