Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: BHPS analysts


From   Brendan Halpin <[email protected]>
To   Yasir Zuberi <[email protected]>
Subject   Re: st: BHPS analysts
Date   Fri, 28 Mar 2014 23:33:58 +0000

You are not providing enough information, but I will guess at what is
going on:

> I'm trying to use the BHPS data with stata and merge key variables which
> I'm interested in. The problem I have is adding a time variable "year"
> by using "gen year= xxx". When I add this variable to each wave and then
> attempt to merge by sort PID. Stata only picks up one year "2008".

I guess you are merging waves into a single wide data set (using
-merge-). If in the individual wave data sets you define the year (gen
year=2008, gen year=2009, etc) when you merge them the variable year
will have the first non-missing value.

If you want a single variable, year, with different values for each
wave, you need a "long" data format, which you get with -append-, not
merge.

Alternatively you need wave specific wave variables, e.g.
gen ayear = 1991, gen byear=1992 etc. Then when you -merge- there are
multiple year variables with distinct values. 

Brendan
-- 
Brendan Halpin, Head, Department of Sociology, University of Limerick, Ireland
Tel: w +353-61-213147  f +353-61-202569  h +353-61-338562;  Room F1-002 x 3147
mailto:[email protected]    ULSociology on Facebook: http://on.fb.me/fjIK9t
http://teaching.sociology.ul.ie/bhalpin/wordpress         twitter:@ULSociology
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index