Hello, I need some. I'm new with STATA so I'm in the learning process.
I have a database which is composed by households. The key variable is mergeid (for example: BO-272515-01, BO-272515-02).Some questions are addressed only to one household respondent. So I'll have questions with missing values only because the question was addressed only to one person from that household. So they are not truly missing. What I need to do is to replace those responses which are supposed to be missing with the responses of the person who responded to that question. For example in the picture attached we have the household RO-002148-A and for this HH we have 2 respondents (RO-002785-01 & RO-002785-02). What I want to do is complete the missing value for RO-002785-02 with the answer of RO-002785-01 and so on.
[ATTACH=CONFIG]temp_22253_1619184635024_255[/ATTACH]
I run this code but the replacements are not correct:
duplicates tag hhid8,generate(duple)
replace ho023_=ho023_[_N] if (duple==1)
Could you please help me ?
Thank you in advance!!!
Related Posts with Replace values for duplicates
Missing data analysis by interviewdateHi all, I am using Stata IC 15 and I have a dataset that refers to data collected over the years (i…
Dynamic panel data estimation, 2+ periods only for dependent variableHi everyone, Essentially, I would like to run a first difference regression which includes the lag o…
How can I create new variables from one or more parts of a large dataset?Dear all, Newbie question here. Usually, I split a large variable creating new dataset for each va…
Regression on time-series and cross-sectional dataHi, While writing an essay on transitions to democracy in SSA mainly using logit models for surviva…
Singular weighting matrix in 2-step GMM with xtabond2Dear Statalisters, When running a GMM in a 2-step procedure we use the optimal weighting matrix to …
Subscribe to:
Post Comments (Atom)
0 Response to Replace values for duplicates
Post a Comment