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
And/or symbolIs there an and/or command in Stata? I would like to generate a variable (recoverev) that would equa…
Using a string variable as xlabel for plotsDear all, I would like to plot the weekly values of my three variables (1) amount of tests performe…
How to make scatterplot for three groups across time while controlling for covariates of nuisanceHi everyone! Excuse the kind of basic question, but I am very new to Stata. I am trying to make a …
Help with reclink: perform fuzzy matches of a variable within exact matches of another variableI am trying to perform a record linking in which I have two variables: 'cod' is a 6-digit code store…
How to remove all characters that are not part of a predefined list?How can I remove from a STRING VARIABLE all characters that are not part of a predefined list? For e…
Subscribe to:
Post Comments (Atom)
0 Response to Help with long data and counting unique variables by dates
Post a Comment