Insecurity Code 1

This do-file generates variables used in the SMH paper. The original data set ("gss0610") is an appended file of GSS 2006 and GSS 2010.

// Task: generate variables
// Project: insecurity in context

******************************************
*** 0. Program setup
******************************************

version 11.2
set linesize 80
set maxvar 10000
clear all
macro drop _all

******************************************
*** 1. Open the data set
******************************************

use "gss0610.dta"

******************************************
*** 2. Job insecurity and outcomes
******************************************

gen jobinsecurity = 5 - joblose
  label var jobinsecurity "job insecurity, continuous"

gen generalhappy = 4 - happy
  label var generalhappy "happiness, 3 best"

******************************************
*** 3. Predictors
******************************************

// education
recode degree (0/1 = 1) (2 = 2) (3/4 = 3), gen(edu)
  label var edu "3-category education: <= HS, some college, >= college"
  label define edu1 1 "1 High school or less" 2 "2 Some college" 3 "3 College or more"
  label values edu edu1

gen hs = (edu == 1) if edu < .
  label var hs "high school or less"
  label define hs1 1 "1 high school or less" 0 "0 more than high school"
  label values hs hs1

gen somecg = (edu == 2) if edu < .
  label var somecg "some college"
  label define somecg1 1 "1 some college" 0 "0 high school or less, or college or more"
  label values somecg somecg1

gen cg = (edu == 3) if edu < .
  label var cg "college or more"
  label define cg1 1 "1 college or more" 0 "0 less than college"
  label values cg cg1

// income
recode rincom06 (1 = 500) (2 = 2000) (3 = 3500) (4 = 4500) (5 = 5500) (6 = 6500) (7 = 7500) (8 = 9000) (9 = 11250) (10 = 13750) (11 = 16250) (12 = 18750) (13 = 21250) (14 = 23750) (15 = 27500) (16 = 32500) (17 = 37500) (18 = 45000) (19 = 55000) (20 = 67500) (21 = 82500) (22 = 100000) (23 = 120000) (24 = 140000) (25 = 200000), gen(incomerec)
  label var incomerec "personal income, recoded using mid-point"

gen logincome = log(incomerec)
  label var logincome "logged personal income"

// class
gen middleclass = .
  replace middleclass = 1 if (class == 3 | class == 4)
  replace middleclass = 0 if (class == 1 | class == 2)
  label var middleclass "middle class"

gen workingclass = .
  replace workingclass = 1 if (class == 1 | class == 2)
  replace workingclass = 2 if (class == 3 | class == 4)
  label var workingclass "workingclass, 1/2"

gen workingclassd = (workingclass == 1) if workingclass < .
  label var workingclassd "workingclass, 0/1"

******************************************
*** 4. Covariates
******************************************

gen agesq = age^2
 label var agesq "age squared"

gen female = sex - 1
  label var female "female"
  label define female1 1 "1 Female" 0 "0 Male"
  label values female female1

gen black = .
  replace black = 1 if race == 2
  replace black = 0 if (race == 1 | race == 3)
  label var black "Black"
  label define black1 1 "1 Black" 0 "0 Non-black"
  label values black black1

gen selfemployed = 2 - wrkslf
  label var selfemployed "self-employed"
  label define selfemployed1 1 "1 Self-employed" 0 "0 Work for somebody"
  label values selfemployed selfemployed1

gen PT = (wrkstat == 2) if wrkstat < .
  label var PT "working part-time"
  label define PT1 1 "1 Working part-time" 0 "0 Working fulltime or temp not working"
  label values PT PT1

gen married = (marital == 1) if marital < .
  label var married "married"
  label define married1 1 "1 Married" 0 "0 Not married"
  label values married married1

gen divorced = (marital == 3 | marital == 4) if marital < .
  label var divorced "divorced/separated"
  label define divorced1 1 "1 Divorced/Separated" 0 "0 Not divorced/separated"
  label values divorced divorced1

gen widow = (marital == 2) if marital < .
  label var widow "widowed"
  label define widow1 1 "1 Widowed" 0 "0 Not widowed"
  label values widow widow1

gen nvmarried = (marital == 5) if marital < .
  label var nvmarried "never married"
  label define nvmarried1 1 "1 Never married" 0 "0 Not never married"
  label values nvmarried nvmarried1

gen year2006 = (year == 2006) if year < .
  label var year2006 "surveyed in 2006"

gen year2010 = (year == 2010) if year < .
  label var year2010 "surveyed in 2010"

******************************************
*** 5. Save data set
******************************************

save "2013-05-11 vars generated.dta"