Hello,
I have a similar question as in https://www.statalist.org/forums/for...same-household which has not been resolved yet.
Below I show data of 3 variables: the interview year (int_year), the year the household moved into the house (hhmove) and if the house has a pool (poolacc; 1=yes, 2= no).
FYI: the data comes from the American Housing Survey, which interviews the same houses every 2 years.
For variables of other housing characteristics I have values for all interview years (2001-2011), except for variable 'poolacc'. For this variable, only values in 2011 are available.
I am trying to impute/copy the same values of poolacc of int_year=2011 to the other interview years as my mentor has instructed me (assuming the houses always had or did not have a pool in the years before).
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float int_year int hhmove byte poolacc 2009 2008 . 2009 2007 . 2009 2007 . 2009 2008 . 2009 2007 . 2009 2007 . 2009 2007 . 2009 2007 . 2009 2007 . 2009 2008 . end
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float int_year int hhmove byte poolacc 2011 2009 2 2011 2010 2 2011 2009 2 2011 2010 1 2011 2009 2 2011 2010 2 2011 2011 1 2011 2009 1 2011 2010 2 2011 2009 2 end
Thanks in advance!
Related Posts with How can I copy values for a variable to other observations within the same variable?
margins after an unconditional melogit modelI'm trying to understand what the margins command does after an unconditional melogit model. Specifi…
on biprobit modelHi everyone, This might seem a silly question but for some reason, I am trying to use biprobit model…
Multiple imputation with weighted dataI've calculated Prevalence Ratios (IRR through Poisson with robust error variance) on Stata 14.2 for…
endogeneity test in PPMLHDFEHi Tom Zylkin Joao Santos Silva, I am looking for the impact of non-tariff measures on Peruvian exp…
Connecting Stata to Snowflake ODBCHello all. I'm looking for some assistance or guidance in setting up a Snowflake ODBC connection for…
Subscribe to:
Post Comments (Atom)
0 Response to How can I copy values for a variable to other observations within the same variable?
Post a Comment