Hi,
I have previously posted here and received great help. Need help with one last area that I am really struggling with. I am trying to find the type of procedure that occurs for the second procedure. My data shown below is in long format. There are multiple observations per id number.
date_order is the order of the procedure with date_order 2 correlating to the 2nd procedure I am trying to identify.
_j is procedure they had, with _1, _2, and _3 all representing different procedures.
If patients only received one procedure as their 2nd procedure, i.e. only _j == _1 & date_order==2 it would be easy. But some patients received 2 different procedures on their second procedure (or date_order == 2). For example, id = 2 received procedure _1 and procedure _2. I want to create a variable that captures patients who had two procedures for their date_order ==2 and cannot figure it out.
Any help?
----------------------- copy starting from the next line -----------------------
[CODE]
* Example generated by -dataex-. To install: ssc install dataex
clear
input float id long date_order str2 _j float proc
2 2 "_1" 43
2 2 "_2" .
2 2 "_2" 42
2 2 "_3" .
2 2 "_3" .
2 2 "_1" .
9 2 "_1" 336
9 2 "_2" .
9 2 "_3" .
9 2 "_2" .
9 2 "_3" .
9 2 "_1" 336
9 2 "_1" 336
9 2 "_2" .
9 2 "_1" 336
Related Posts with Help with long data
Merging datesHi, I'm trying to merge two dates variables from the same dataset, but I would like to prioritize o…
Is it possible to divide a variable by the mean across individuals for a regression???Hello, is it okay to divide each individual's value of a variable by the mean of the sample and the…
factor variables and time-series operators not allowedHi, I am trying to run the following the codes, but get the error message "factor variables and tim…
Three way tables using svysetHello, I am using Stata 13 and I have a question regarding three way tables while using complex sur…
Assigning variable values to observations based common values of other variables...I have a data set with 3 variables: one identifies the contract number; one identifies the type of c…
Subscribe to:
Post Comments (Atom)
0 Response to Help with long data
Post a Comment