Hi
I need some help with Stata syntax. I have a dataset with persons who have participated in a health survey, and later had a specific surgery, aprox. 1000 persons and 650 variables. The health surveys have been performed every 5-10 years from 1970 to 2018, a total of 7 times. Each survey has about 100 variables. The persons have participated in between 1 and 7 surveys. The dataset is organised like this:
ID date1 height1 weight1 bloodpressure1 ....... date2 height2 weight2 bloodpressure2 ........ date3 height3 weight3 bloodpressure3 ...[....] date7 height7 weight7 ...... date_of_surgery
For each person, I want to perform analyses on the variables from the survey closest to date of surgery (before surgery, not after). How do I transform my dataset to select only those variabels? Date of surgery is sometimes between surveys, sometimes after the last survey.
I am grateful for any tips.
Related Posts with How to choose part of dataset based on date
Create 2 new variables from existing variables: one date, and one with value equal to another variable's name
Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input float(study_id r…
Foreach Loops for excel graph exportI could not figure out how to delete this post but no longer need it
…
Is not a two-way plot typeHello,
I keep getting the error not a twoway plot type. Was wondering if anyone had any suggestions…
Log4j vulnerability (CVE-2021-44228 and subsequent CVE-2021-45046)Thank you James Hassell (StataCorp) for placing a comment regarding the Log4j vulnerability in Stata…
problem with collect layoutHello Statalisters,
I'm having an issue obtaining the table that I want using collect with mi estim…
Subscribe to:
Post Comments (Atom)
0 Response to How to choose part of dataset based on date
Post a Comment