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?*
Generate moving sum of 24 variables in dataset with > 800,000 observationsDear Statalist, I’ve got a dataset with >850,000 observations of individuals with 132 dummy vari…
95% confidence interval with invlogitGreetings, I'm having a problem analysing my dataset. I'm trying to get the prevalence and 95% CI us…
DistributionI am trying to create two distributions like those attached. can someone help with the code to creat…
How do I change the format of date variable in STATA 15Hi, Is there a way I can change the following variables into a singular format? I have 900+ observa…
Understanding Logit and Probit outputI am currently running Stata14 to analyse a dataset of 228 observations. The dependent variable is b…
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