Hi,
I am in desperate need of help! I tried to show my data with dataex but given the size (25 million observations) there are a lot of limitations so I will show the best example below.
id sequence_ date_procedure procedure_1 procedure_2
1 942 3/3/2011 1 .
1 942 3/3/2011 . .
1 942 3/3/2011 1 1
1 952 5/5/2012 . 1
1 952 5/5/2012 . 1
1 952 5/5/2012 . .
the code for sequence was : egen sequence=group(date_procedure)
procedure 1 and procedure 2 can occur on the same or different dates and are based on hcpcs codes in medicare. There may be more than one code for the procedure that is listed which is why procedure can occur twice in the same date.
dates are %tdnn/dd/CCYY format
I want to do two things:
1. I want to count the total number of unique procedures that a patient received. I am having a hard time figuring out how to do this based since the data is in long format and the same procedure may be listed multiple times due to repeat HCPCS codes.
2. I want the date of the second procedure that patients received.
I apologize if this is not a great format to put this question in. Please let me know if I can improve the post or clarify what I need.
Thank you in advance
Related Posts with Help with long data and counting unique variables by dates
Proper titles for outreg2 output tableDear Stata users, I am trying to export summary statistics using outreg2 function with the followin…
Can I use logit without with YES/NO data instead of 0/1?Hi, everyone, All my data are in YES/NO values instead of 0/1. And I want to find the correlation a…
Question regarding Wilcoxon signed-rank tests for weighed dataI am using sample weighted data. I want to compare a result before and after an intervention. I woul…
Two sample unpaired ttest with mean difference specifiedI need to run a t-test on a two sample group that is unpaired with unequal variance for a specific m…
How do I visualize the relationship between a continuous and a ordinal variable?Hi, I would like to create a scatterplot including a linear regression line. The x-axis should be o…
Subscribe to:
Post Comments (Atom)
0 Response to Help with long data and counting unique variables by dates
Post a Comment