Announcement

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

  • How to construct an experience variable in the PSID

    Dear Statalist:

    I would like to construct an experience variable for the PSID data, for every year, for each Head of the Household. For the moment, I am not using the data longitudinally. Just cross sectionally.
    Starting in 2003, the PSID runs the survey every other yer. So, for the in-between years, it asks questions about the beginning and end date and month for each job the Head has had, up to four jobs. It also asks for the occupational category the job is in. So for the most recent job, call it job 1, I wrote the following basic (I am not a Stata expert, I just have a a rudimentary knowledge of the basic commands) :

    Example
    gen mngm1=0
    replace mngm1=1 if ER21145>=1 & ER21145 <=43

    gen bus1=0
    replace bus1=1 if ER21145>=50 & ER21145 <=73
    ....and so on...

    to create the dummy variables for every US CENSUS occupational category,

    Then, I created a new "tenure" variable by calculating the difference in the years of tenure at job 1, in each occupational category:

    generate ten1mngm1= yendjob1- ystartjob1 if mngm1==1
    generate ten1bus1= yendjob1- ystartjob1 if bus1==1
    ... and so on...

    This is probably not a good way of doing this, so I wonder if there is a more efficient way of proceeding.

    Also, I am afraid I do not know how to tell state to calculate the difference in in the months of employment in job 1, so that I can get an accurate tenure variable. So, the PSID tells me the start month and the end month (as well as the years, of course!) for each job the person has had. But I do not know how to construct a new variable that calculates that difference in the months.

    Since I want to calculate this experience variable for every year in the PSID, I wonder if someone can help.


    Thank you for all the assistance you can provide on this! Elena Quercioli



  • #2
    I've tried reading this question a few times, and I still can't figure it out. I think that your writing assumes implicitly that everybody here knows what the PSID is, how its data are laid out, and many other aspects of the particular problem you are trying to solve. This is a multidisciplinary forum. Probably there are people here who fit that bill--but your chances of getting a rapid and helpful response would be improved if you rewrote the question in terms that anyone familiar with Stata could understand, even if they've never heard of the PSID or US Census occupational categories. So that would include things like showing a sample of the relevant data. The details of the data layout really matter. Please install the -dataex- command (-ssc install dataex-) if you do not already have it, and use it to post a representative example of the data.

    In addition, your code
    Code:
    gen mngm1=0
    replace mngm1=1 if ER21145>=1 & ER21145 <=43 
    
    gen bus1=0
    replace bus1=1 if ER21145>=50 & ER21145 <=73 
    ....and so on...
    certainly is suggestive of a pattern that might be simplified with a loop. But the "and so on" part is a complete mystery to me. What else belongs to the sequence mngm, bus,... What are the next magic numbers after 1, 43, 50, 73 ?

    I gather you are trying to create indicator ("dummy") variables for US Census occupational categories. But without knowing what those categories are or how you can find them from your data, there is no moving forward on that.

    About the only concrete advice I can give you based solely on what I understand from your post is this. Sequences like:

    Code:
    gen x = 0
    replace x = 1 if whatever
    can be simplified to
    Code:
    gen x = whatever
    But that is a very minor tweak and does not get at your main objective.

    Comment


    • #3
      Thank you for the suggestions. I will try to repost my query in a clearer fashion.

      Comment

      Working...
      X