Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Generating and coding data

    Hi all,

    I could use some guidance on how to re-code and generate variables so that my data makes sense.At the moment I have a dataset that includes husbands and their spouses. They each have a unique ID and a household ID (includes the husband and spouse) - "indid" and "hhid".

    I currently have these variables in the dataset:

    Description: Individual's father live in same household. Variable name: q0113, q1101 (coded as 1 for yes and 2 for no)
    Description: Individual's mother live in same household. Variable name: q0115, q1201 (coded as 1 for yes and 2 for no)

    Using the variables q0113 and q1101 to identify if an individual’s father lives in the same household and q0115 and q1201 if an individual’s mother lives in the same household – I need to create a new variable called “livingstructure” such that:
    • If the Head records that his father and/or mother lives in the same household we code it as “1” for patrilineal.
    • If the spouse record that her father and/or mother lives in the same household we code it as “2” for matrilineal.
    • If both Head and spouse records mother/father as residing in the same household we code it as “3” for extended.
    • If neither the Head or spouse record mother/father residing in the same household we code it as “4” for nuclear.
    However, before I begin any analysis I will be dropping the heads (husbands) from my dataset meaning the variable needs to be recorded for each husbands corresponding spouse. This is the part that's throwing me off in terms of coding. Apologies for the long winded question. Any help would be greatly appreciated.
    Last edited by sladmin; 01 Feb 2018, 08:28. Reason: anonymize poster

  • #2
    I'm confused by your description of the data and the problem. For example:
    Description: Individual's father live in same household. Variable name: q0113, q1101 (coded as 1 for yes and 2 for no)
    Why are there two variables to record one bit of information? Are they always the same? If so, why are they both provided? If they are not the same, what is the difference between them? Same questions for individual's mother living in the same household.

    However, before I begin any analysis I will be dropping the heads (husbands) from my dataset meaning the variable needs to be recorded for each husbands corresponding spouse.
    If you are dropping the heads before you do this analysis, it seems that is clearly impossible to incorporate any information about them into the analysis. Why not wait to drop the heads until after you've done this? This seems so obvious that I can't help but think I'm missing something or deeply misunderstanding the problem.

    Look, describing a data set in words is often an exercise in futility. It might be clearer if you posted an example of your data set using the -dataex- command. (Which, by the way, would have taken you a small fraction of the time it takes to try to describe it in words.) If you are running Stata version 15.1, then -datatex- is part of your installation already. If running an earlier Stata, run -ssc install dataex- to get the command. Either way, run -help dataex- to read the simple instructions for using it. It takes just seconds to use -dataex- to provide a way for those who want to help you to create a complete and faithful replica of your example data in their own Stata. That, in turn, eliminates all sorts of questions that are left unanswered by descriptions or even by data listings and tables. And it enables people to test out code, so that you get the right answer the first time.

    Comment

    Working...
    X