03-20-2015 01:43 AM
I have data from 5 study visits that assessed health behaviors. The same questions were asked at each visit and I would like to determine how many unique participants reported one behavior. I have the data sets appended in long format, so I can run a proc freq and get that 110 participants reported the behavior across all visits but I want to know how many of those are unique participants versus the same participants reporting the behavior at each visit. Ideally I would like to know how many participants reported the behaviors at all visits, how many at any visit, and how many reported 1, 2, 3, and 4 visits. I previously asked a similar question but was not able to figure this out. Any suggestions would be greatly appreciated.
03-20-2015 01:09 PM
If by long you mean you have data as:
ID VisitDate Behavior or similar:
behaviorcount = (behavior='behavior value of interest');
proc summary data=temp nway;
output out=want sum=;
will have the number of visits with the specified behavior across all visits for each ID. ID could be several variables that uniquely identify the patient.
03-20-2015 02:05 PM
You can also use either count distinct in a proc sql or use a double proc freq - first time include the participant ID, the second you don't.
For more help please post sample data and expected output that corresponds to your sample data.
03-20-2015 05:02 PM
I am not sure I understand the code from ballardw and I tried count distinct but that doesn't seem to give me what I want either. I can't attach an excel right now for some reason but below is a short example of what I would want to do. I just made up the example data. I would want to know how many people did the behavior at 1 visit, at 2 visits, at 3 visits, etc. so from the data the results would be this, 1=yes, 2= no in the code for behavior:
0=1 (did not report)
03-20-2015 05:34 PM
With that coding:
proc means data=have sum;
If 1 represents have the behavior then the sum would be how many visits exhibited the behavior for each PID value.
Need further help from the community? Please ask a new question.