Dear Statalisters,
I would like to get your help with some command coding.
a_hidp is a household number, pidp is a personal number. There are 6 dummy variables that are related to social-classes (from Professional to Unskill)
For example, Professional is the highest social class and Unskill is the lowest social class.
I want to know the social class of those aged 16-18. However, the 6 dummy variables of those aged 16-18 are almost always 0 as they do not have a job yet.
But, I can do this by looking at their parents' social classes and copy-pasting the higher values of their parents to the dummy variables of their children aged 16-18.
This sounds very incomprehensible.
Let me give you an example; row 8~10 (household: 68141443). This is a family with a 47-year-old mum, a 50-year-old dad and a 17-year-old daughter.
Her mum has a higher social class (SkillNonMa > SkillManual) than her dad.
So, I want to copy-paste her mum's dummy variables to those of her daughter.
Hence, row 10 would look the following way;
row a_hidp pidp a_sex a_dvage professional MngTechnical SkillNonma SkillManual Partlyskill Unskill
10 68141443 68141455 female 17 0 0 1 0 0 0
Would there be any way to do this for all the households?

dataex a_hidp pidp a_sex a_dvage Professional MngTechnical SkillNonManual SkillManual PartlySkill Unskill in 8/20
----------------------- copy starting from the next line -----------------------
------------------ copy up to and including the previous line ------------------
Listed 13 out of 1674 observations
I would like to get your help with some command coding.
a_hidp is a household number, pidp is a personal number. There are 6 dummy variables that are related to social-classes (from Professional to Unskill)
For example, Professional is the highest social class and Unskill is the lowest social class.
I want to know the social class of those aged 16-18. However, the 6 dummy variables of those aged 16-18 are almost always 0 as they do not have a job yet.
But, I can do this by looking at their parents' social classes and copy-pasting the higher values of their parents to the dummy variables of their children aged 16-18.
This sounds very incomprehensible.
Let me give you an example; row 8~10 (household: 68141443). This is a family with a 47-year-old mum, a 50-year-old dad and a 17-year-old daughter.
Her mum has a higher social class (SkillNonMa > SkillManual) than her dad.
So, I want to copy-paste her mum's dummy variables to those of her daughter.
Hence, row 10 would look the following way;
row a_hidp pidp a_sex a_dvage professional MngTechnical SkillNonma SkillManual Partlyskill Unskill
10 68141443 68141455 female 17 0 0 1 0 0 0
Would there be any way to do this for all the households?
dataex a_hidp pidp a_sex a_dvage Professional MngTechnical SkillNonManual SkillManual PartlySkill Unskill in 8/20
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long(a_hidp pidp) byte a_sex int a_dvage float(Professional MngTechnical SkillNonManual SkillManual PartlySkill Unskill) 68141443 68141447 2 47 0 0 1 0 0 0 68141443 68141451 1 50 0 0 0 1 0 0 68141443 68141455 2 17 0 0 0 1 0 0 68155043 68155047 2 51 0 0 0 1 0 0 68155043 68155051 1 57 1 0 0 0 0 0 68155043 68155059 2 19 0 0 0 0 0 0 68155043 68155063 1 16 0 0 0 0 0 0 68197883 68197887 2 48 0 0 1 0 0 0 68197883 68197891 1 18 0 0 0 1 0 0 68293083 68293087 2 41 0 0 0 0 0 0 68293083 68293091 1 46 0 1 0 0 0 0 68293083 68293095 1 21 0 0 1 0 0 0 68293083 68293099 1 18 0 0 0 0 0 0 end label values a_hidp a_hidp label values a_sex a_sex label def a_sex 1 "male", modify label def a_sex 2 "female", modify label values a_dvage a_dvage
Listed 13 out of 1674 observations
Comment