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
How do I obtain the predicted survival function for time varying weibull survival regression (streg)?Dear All, Please can anyone help me to solve this simple problem that I cannot solve. I tried to re…
How to import JSON into StataHi, I am using Stata 17 and would need some help in importing JSON into Stata. This is my first tim…
Merging panel data filesHi all, I'm using Stata 13 I have two panel datasets which I want to combine before performing panel…
xthybrid and xtlogit produce slightly different resultsDear statalisters, I am studying why people not use contraception in an unbalanced panel of 11 wave…
Counting amount of times a specific value occurs in a variableHi, I am trying to calculate the number of times a specific value (in this case a string) occurs in …
Subscribe to:
Post Comments (Atom)
0 Response to Help with long data and counting unique variables by dates
Post a Comment