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
How to write a command for nultiple condition with a character variable?Hi all, in my study, I want to study the subsample without observations from some countries without …
Problem with the Stata GraphHey guys, I'm quit new to Stata and want to give out a graph in Stata. I have import and export Dat…
Change in a variable when we have pooled cross-sectionsHello, How can we calculate the change in a variable when its values for two consecutive years are …
Drawing a graph with insignificant*coefficient!Hi, Can we draw a graph when some of our regression coefficients show up as insignificant? Specific…
RMSEA 90% CI using Satorra-Bentler in sem CFAI am running a CFA using sem but am having trouble figuring out the output and possibly whether ther…
Subscribe to:
Post Comments (Atom)
0 Response to Replace values for duplicates
Post a Comment