Hi Statalist experts,
I would need a little help. I'm working with a dataset containing the following 3 variables:
1) household identifier (idhh)
2) individual identifier (idpers)
3) demographic age (dag)
I would like to create a new variable (var1) who assigns value 1 to all the members of a household if there is AT LEAST an individual with dag<18 in that same household (same idhh), and zero otherwise.
How can I translate this command in Stata language?
Thanks in advance for your help!
Andrea
Related Posts with How to assign the same value to all members of a group if a condition on a certain variable occures AT LEAST once in the same group
weighted averageHi, I have a database of donations and I want to use it to generate a new var to indicate donors ide…
How to perform impulse response function (IRF) and forecast error variance decomposition (FEVD) based on panel VECM?Hi all, I am currently working on a panel error correction model (PVECM), and trying to perform IRF…
Stata Version and MEOLOGIT Model ConvergenceBasic question here, but when collaborating on analysis with a colleague with a different version of…
stack or reshape?Dear All, I have this dataset Code: * Example generated by -dataex-. To install: ssc install datae…
Getting STATA to loop phrases (2 or more words with spaces in between)Hello, I'm trying to construct a foreach loop where I am using a few words as the phrase to loop o…
Subscribe to:
Post Comments (Atom)
0 Response to How to assign the same value to all members of a group if a condition on a certain variable occures AT LEAST once in the same group
Post a Comment