Hi everyone,
I am analyzing mortality data from the National Health Interview Survey. The public use data file includes year of interview and year of death. I want to use these two variables to calculate duration of follow-up using these criteria:
a) if the respondent died in the same year when they were interviewed, assign 0.5 years of follow-up time.
b) assign all others, 0.5 years of follow-up time during the year of their interview, full year of follow-up for each year after their year of interview, until the year prior to their death, and then another 0.5 year of follow-up during the year of their death.
As you can see in the screenshot below among those who were interviewed in 1986, 168 died the same year. Of the remaining, 385 died the next year; 481 the following year and so on.
[ATTACH=CONFIG]temp_12908_1545788917819_951[/ATTACH]
Both year variables (year of interview and year of death) are numeric. I generated a new variable by taking the difference between the two year variables and assigned a value 0.5 if the difference was 0. But am having a hard time creating a loop to automate the process to complete (b). Any help is greatly appreciated. I'm using Stata 14 on Windows 10.
Thanks,
Ahmed
Related Posts with Calculating duration of follow-up time
xtivreg2 warning that covariance matrix is not of full rank. Detecting singletons?Dear all, I am running the following code: . xtset id year . xi: xtivreg2 `t' (`z'=instrument_p) …
How to identify parents not co-residing with their children using household dataDear all, I need to create a variable which identifies, for each individual, the following statuses:…
What are the advantage of adding interactive variable over subsampling in drawing conclusions?There are two main advantages of adding interaction variables over subsampling are: (1) having highe…
How to obtain ML (Cox-Snell)R2 after using seemly unrelated regression (sureg)Dear forum, I have a basic doubts of methodology for which many of you may know the answer. I am u…
Generate variable of ratios of consecutive observations, by subgroupHello. I am working with a panel dataset as characterized below. Code: * Example generated by -da…
Subscribe to:
Post Comments (Atom)
0 Response to Calculating duration of follow-up time
Post a Comment