That calls for an extra if condition on every command, I imagine.
-
Login or Register
- Log in with
self report of high hypertension : 1( yes ) 0 ( no) | |
id1, id2 = member family list | |
report treatment = 1(yes) 0 ( no) same report treatment |
ID | id | self report of high hypertension | id1 | report treatment1 | id2 | report treatment2 |
001 | 1 | 1 | 2 | 1 | 1 | 0 |
001 | 2 | |||||
002 | 1 | 1 | 2 | 0 | 3 | 1 |
002 | 2 | |||||
002 | 3 | |||||
003 | 1 | 0 | ||||
003 | 2 | |||||
003 | 3 |
* Example generated by -dataex-. To install: ssc install dataex clear input int HHID byte V003 long SH27 byte SH27O_1 long SH27T_1 byte SH27O_2 long SH27T_2 float(SH27O_3 SH27T_3) 2003 1 . . . . . . . 2003 2 1 . . . . . . 2007 1 1 . . . . . . 2011 1 2 1 1 3 1 . . 2011 2 . . . . . . . 2011 3 . . . . . . . 2015 1 . . . . . . . 2015 2 2 2 1 4 0 . . 2015 3 . . . . . . . 2015 4 . . . . . . . 2019 1 . . . . . . . 2019 2 1 . . . . . . 2019 3 . . . . . . . 2023 1 1 . . . . . . 2028 1 . . . . . . . 2028 2 2 1 2 2 1 . . 2032 1 1 . . . . . . 2036 1 . . . . . . . 2036 2 1 . . . . . . 2040 1 1 . . . . . . 2040 2 . . . . . . . 2040 3 . . . . . . . 2044 1 2 1 1 2 1 3 1 2044 2 . . . . . . . 2044 3 . . . . . . . 2048 1 1 . . . . . . 2048 2 . . . . . . . end label values SH27 SH27_N label def SH27_N 1 "No", modify label def SH27_N 2 "Si", modify label values SH27T_1 SH27T_1N label def SH27T_1N 1 "No", modify label def SH27T_1N 2 "Si", modify label values SH27T_2 SH27T_2N label def SH27T_2N 0 "No", modify label def SH27T_2N 1 "Si", modify label values SH27T_3 SH27T_3 label def SH27T_3 1 "Si", modify
* Example generated by -dataex-. To install: ssc install dataex clear input int HHID byte V003 long SH27 byte SH27O_1 long SH27T_1 byte SH27O_2 long SH27T_2 float(SH27O_3 SH27T_3) 2003 1 . . . . . . . 2003 2 1 . . . . . . 2007 1 1 . . . . . . 2011 1 2 1 1 3 1 . . 2011 2 . . . . . . . 2011 3 . . . . . . . 2015 1 . . . . . . . 2015 2 2 2 1 4 0 . . 2015 3 . . . . . . . 2015 4 . . . . . . . 2019 1 . . . . . . . 2019 2 1 . . . . . . 2019 3 . . . . . . . 2023 1 1 . . . . . . 2028 1 . . . . . . . 2028 2 2 1 2 2 1 . . 2032 1 1 . . . . . . 2036 1 . . . . . . . 2036 2 1 . . . . . . 2040 1 1 . . . . . . 2040 2 . . . . . . . 2040 3 . . . . . . . 2044 1 2 1 1 2 1 3 1 2044 2 . . . . . . . 2044 3 . . . . . . . 2048 1 1 . . . . . . 2048 2 . . . . . . . end label values SH27 SH27_N label def SH27_N 1 "No", modify label def SH27_N 2 "Si", modify label values SH27T_1 SH27T_1N label def SH27T_1N 1 "No", modify label def SH27T_1N 2 "Si", modify label values SH27T_2 SH27T_2N label def SH27T_2N 0 "No", modify label def SH27T_2N 1 "Si", modify label values SH27T_3 SH27T_3 label def SH27T_3 1 "Si", modify tempfile copy save `copy' keep HHID SH27O* SH27T* gen long obs_no = _n reshape long SH27O_ SH27T_, i(obs_no) j(_j) rename *_ * assert missing(SH27O) == missing(SH27T) drop if missing(SH27O) drop obs_no _j rename SH27O V003 merge 1:1 HHID V003 using `copy', assert(match using) order SH27T, last sort HHID V003
Comment