Hi there,
Hope you all are well.
I am trying to generate a new variable that takes the age value of correspondent variable. For instance, if the disease code was found in variable A_2001_0_0 then the new variable will take the age value in n_2001_0_0. And if the code was in A_2001_0_4 then it takes the age value in n_2001_0_4 etc. The age values could be -1, >1, or missing(.). This will help as there are hundreds of variables like this. I am particularly interested in code 1044. So, wherever the code 1044 was first found, I want the age value in the same correspondent variable.
The data looks like:
I have searched the forum but didn't find something quite similar. If there is problem like this, please refer me to it and accept my apology.
Any suggestions?
Hope you all are well.
I am trying to generate a new variable that takes the age value of correspondent variable. For instance, if the disease code was found in variable A_2001_0_0 then the new variable will take the age value in n_2001_0_0. And if the code was in A_2001_0_4 then it takes the age value in n_2001_0_4 etc. The age values could be -1, >1, or missing(.). This will help as there are hundreds of variables like this. I am particularly interested in code 1044. So, wherever the code 1044 was first found, I want the age value in the same correspondent variable.
The data looks like:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(A_2001_0_0 A_2001_0_1 A_2001_0_2 A_2001_0_3 A_2001_0_4 n_2007_0_0 n_2007_0_1 n_2007_0_2 n_2007_0_3 n_2007_0_4) 1044 . . . . 60.23 . . . . 1044 . 1044 . . 66.02 . 69 . . 1044 1003 . . . 56.5 54 . . . . . 1044 . . . . -1 . . 1044 1044 . . 1044 55 58 . . 60 1015 . . . 1044 45 . . . 47 end
Any suggestions?
Comment