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
Looping over two tablesDear group, I have a question about looping over two tables. In my first table, I have a list of in…
tline on top of the graph using command twoway areaHi, I want to plot a reference line on top of the graph using command tline, but it's just under the…
Comparing two dependent variables with different frequency distributions So I am running these two OLS regressions on two DVs, each having the same IVs. The problem is, on…
Convert time with a 12 hrs setting, to 24 hrsDear all, I have to convert a variable setting in "12 hours" to "24 hours". I divided the variable …
Can I simulate a children income distribution based on the marginal distribution of their fathers' income and a given copula?Dear all, I would very much appreciate your thoughts on the following question: I have the data on …
Subscribe to:
Post Comments (Atom)
0 Response to Replace values for duplicates
Post a Comment