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?
Difficulty in handling data using multiple imputationDear Stata-community, I am working on a dataset with information on household expenditures. My datas…
RD analysis with covariate coefficientsHi Statalist I am performing an RD analysis investigating the effects of reduced social benefits on…
Is there a command that is equivalent to "bsample more than _N"?The command bsample B with B > _N (e.g., if _N = 100., trying to sample more than 100 times wi…
attribute the displayed output of a command in local macroI am trying to attribute the output of a command that just prints and output to the Stata screen (pr…
Merge problemsHello dear stata friends, we are pretty new on stata and would like some help. We managed to merge …
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