The dataset is laid out in longitudinal format where the patient id (pid) is the first column, and the second column "PE"is if
the patient received duplicated physical check-up during their hospital stay. I want to create a new variable "RE" that can achieve
the goal like this: if PE has duplicates, then RE=1; If not, RE=0.
* Example generated by -dataex-.
clear
input byte (pid PE)
1 1
1 2
1 3
1 4
2 1
2 2
2 3
2 3
3 1
3 1
3 2
3 3
4 1
4 1
4 2
4 3
end
Thank you for your help!
Related Posts with How to create a binary variable that identify whether another variable has duplicates in the dataset using Stata?*
Python in StataDear all, I have a question about Python and Stata in version 16. I checked the documentation and ma…
Using loops and assigning particular rules to eachDear Stata list, I am agonising over a problem and would very much appreciate your support. I have …
List of localsHi Statalist! I need to make a list of some locals defined in the .do file, in order to verify if t…
Abbreviate all String Observations in a ColumnHi all, I have a column variable containing only 3- or 4-digit string observations. I just converte…
GMM Panel Data on StataHi, I have a dynamic model where the dependent variable is lagged. Therefore I am using system-GMM a…
Subscribe to:
Post Comments (Atom)
0 Response to How to create a binary variable that identify whether another variable has duplicates in the dataset using Stata?*
Post a Comment