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
Seasonal DummyDear All, I would like kindly to generate two new variables from the following data. The first var…
Multi-level model with mediator and index variable from survey-level dataHi. I am attempting to perform a regression on a combined micro (individual level data from survey …
Mata implementation of Mittag-Leffler functionI have just completed a port to Mata of Roberto Garrappa's MATLAB implementation of his algorithm fo…
Labeling a single observation on a scatter plot.I looking at the relation between years of education and vaccine skepticism across countries. I want…
reshaping and creating unique "j()" within same idHi, I have a long-long format data set as below, I made reshaping before, but this time it is hard t…
Subscribe to:
Post Comments (Atom)
0 Response to Help with long data and counting unique variables by dates
Post a Comment