Creating a binary variable for change (panel data!)

Moderators: statman, Analyst Techy, andris, Fierce, GerineL, Smash

kial8
Posts: 3
Joined: Fri Jul 11, 2014 9:28 am

Creating a binary variable for change (panel data!)

Postby kial8 » Fri Jul 11, 2014 10:04 am

Dear everyone,

I am new to this Forum and also had a long break of using SPSS - now would need some help to get back on track :? .

I have a Panel dataset, with i.e. variables "Person ID" (multiple), "Age" (categorical groups), "Year"(categorical), "Profession"(categorical, i.e. 1=unemployed; 2=farmer,..). I have aggregated data at annual and person ID Basis, so it looks like this at the Moment:

Person ID | Year | Age | Profession
1 | 2009 | 2 | 1
1 | 2010 | 2 | 1
1 | 2011 | 2 | 2
1 | 2012 | 2 | 2
2 | 2009 | 3 | 2
2 ....

Now, for the purposes of later, I would want to create a new binary/dummy variable indicating, whether there happened a change in individual person's profession sometime during the years 2009-2012 (1=Change, 0=No change in Profession). So, i.e. on the above, for Person ID 1 the new binary variable would be 1 in 2011 and otherwise 0.

How could I do this, to see how many of the persons (Person ID) have gone through a Change in Profession, and at which age/year? I can try to clarify in case needed. Thank you!
RubenGeert
Posts: 100
Joined: Mon May 19, 2014 6:06 am

Re: Creating a binary variable for change (panel data!)

Postby RubenGeert » Fri Jul 11, 2014 2:33 pm

Combine IF (http://www.spss-tutorials.com/if/) and LAG (http://www.spss-tutorials.com/lag/).

Your situation is almost identical to the fifth example that's discussed (http://www.spss-tutorials.com/lag/#example-5).

Kind regards,

Ruben Geert van den Berg
www.spss-tutorials.com
kial8
Posts: 3
Joined: Fri Jul 11, 2014 9:28 am

Re: Creating a binary variable for change (panel data!)

Postby kial8 » Sat Jul 12, 2014 12:44 pm

Dear Ruben,

thank you so much for your reply & the links - your examples really helped me to solve this!
kial8
Posts: 3
Joined: Fri Jul 11, 2014 9:28 am

Re: Creating a binary variable for change (panel data!)

Postby kial8 » Sat Jul 12, 2014 9:05 pm

Dear everyone,

I am still stuck with one problem, and would be extremely grateful for expert help.

How could I create a binary variable so, that it would take into consideration only one certain change in status? For example, only when profession status changes from unemployed to farmer (and thus ignoring any other changes that might happen in profession status, including ignorance of the condition change vice versa, farmer -> unemployed)? So outcome would be: 1= change in status unemployed --> farmer, 0= no change in this status, also ignoring any other changes).

So, i.e. example below, for Person ID 1 the new binary variable would be 1 in 2011 and otherwise for any other cases&changes 0. "Profession" is a categorical variable.

Person ID | Year | Age | Profession
1 | 2009 | 2 | Unemployed
1 | 2010 | 2 | Unemployed
1 | 2011 | 2 | Farmer
1 | 2012 | 2 | Farmer
2 | 2009 | 3 | Blue-collar
2 | 2010 | 3 | Unemployed
...
Thank you a lot for any ideas in advance!
RubenGeert
Posts: 100
Joined: Mon May 19, 2014 6:06 am

Re: Creating a binary variable for change (panel data!)

Postby RubenGeert » Sun Jul 13, 2014 10:07 am

There's two main options.

First (recommended), create some "job_switch" variable that indicates A) the previous AND current job OR B) no switch at all. For some example syntax, see http://spss-tutorials.com/downloads/job_switches.sps

Note that a single variable can hold all relevant information here so I don't see any need for using multiple binary (= dichotomous) variables but you could create those from the single variable in a second step.

Second (not so efficient) throw in extra conditions (with AND) on the IF command regarding the jobs. For instance something like

Code: Select all

compute unempl_to_farmer = 0.
if person_id = lag(person_id) AND profession = "Unemployed" AND lag(profession) = "Farmer" unempl_to_farmer = 1.
exe.
Kind regards,

Ruben Geert van den Berg
www.spss-tutorials.com

Who is online

Users browsing this forum: No registered users and 1 guest

cron