Skip to content. | Skip to navigation

Personal tools
You are here: Home / Data / Program Code / Program Code Forums / SPSS Code / Compute Exact Ages Waves 1 to 4

Compute Exact Ages Waves 1 to 4

Up to SPSS Code

Compute Exact Ages Waves 1 to 4

Posted by Trzesniewski, Kali at December 18. 2012

**Send edits or corrections to Kali Trzesniewski (ktrz@ucdavis.edu)**

FREQUENCIES
VARIABLES=imonth imonth2 imonth3 iyear iyear2 iyear3
/ORDER= ANALYSIS .

FREQUENCIES
VARIABLES=h1gi1m h1gi1y h2gi1m h2gi1y h3od1m h3od1y
/ORDER= ANALYSIS .

RECODE
h1gi1y h2gi1y (74=1974) (75=1975) (76=1976) (77=1977) (78=1978) (79=1979)
(80=1980) (81=1981) (82=1982) (83=1983) (98=SYSMIS) .
EXECUTE .

RECODE
h2gi1m (98=SYSMIS) .
EXECUTE .

FREQUENCIES
VARIABLES=h1gi1m h1gi1y h2gi1m h2gi1y h3od1m h3od1y
/ORDER= ANALYSIS .

FREQUENCIES
VARIABLES=bio_sex bio_sex2 bio_sex3
/ORDER= ANALYSIS .

COMPUTE birthdate = date.moyr(h1gi1m,h1gi1y) .
COMPUTE w1intdate = date.moyr(imonth,iyear) .
COMPUTE w2intdate = date.moyr(imonth2,iyear2) .
COMPUTE w3intdate = date.moyr(imonth3,iyear3) .
COMPUTE w4intdate = date.moyr(imonth4,iyear4) .
EXECUTE .

COMPUTE w1age = DATEDIFF(w1intdate,birthdate,"year") .
COMPUTE w2age = DATEDIFF(w2intdate,birthdate,"year") .
COMPUTE w3age = DATEDIFF(w3intdate,birthdate,"year") .
COMPUTE w4age = DATEDIFF(w4intdate,birthdate,"year") .
EXECUTE .

Attachments
Powered by Ploneboard