I have data as below. Patients can have several visits of various types. Some visit types may repeat (Initial Visit is the exception).
ID Visit VisitDate Other Variables (not shown)
------------------------------------------------------------
1 Initial Visit 1/1/2005
1 Check-Up 2/2/2005
1 Well-Being 3/10/2005
1 Well-Being 7/7/2005
1 Surgery 9/1/2008
------------------------------------------------------------
2 Initial Visit 2/3/2000
2 Check-Up 5/1/2000
2 Well-Being 3/1/2001
------------------------------------------------------------
3 Initial Visit 7/1/2009
3 Surgery 4/1/2010
I'm using Pivot Tables to analyze these data. How can I answer questions like:
1. Among patients who had Well-Being visits, how many had a Surgery visit? [The answer is 2 patients had Well-Being visits, 1 of whom has had a Surgery visit.]
2. What is the average number of days that passed between the Initial Visit and the Surgery Visit?
To answer questions like these via the pivot, I suspect I need to restructure the data somehow, but I'm not entirely sure of the best way of even if that's necessary.
Thank you for any suggestions.
Bookmarks