#delimit ; clear; set more off; set memory 200000; set maxvar 32000; version 9.0; capture: log close; log using "c:\data\psid\eco 721\lab2.log", text replace; /*********************************************************************************/ /* Program: lab2_long_cons_read.do -- Stata do file to read 1968-87 consumption */ /* and other data from the PSID and to illustrate some longitudinal */ /* data techniques */ /* */ /* Authors: D. Ribar March 2009 */ /*********************************************************************************/ /* Read/input data set */ use "c:\data\psid\eco 721\psid_cons_68_87.dta", clear; /* Describe and summarize the data set for documentation purposes */ describe; sum; /* Sort data by household identifier (int_id) and the observation year */ sort int_id year; /* Create difference variable using food needs; note difference can't be defined */ /* until at least the second record and can't be defined for 1974 */ by int_id: generate lnfdstch = ln(tvfdstd) - ln(tvfdstd[_n-1]) if _n>1 & year!=1974; label var lnfdstch "Change in log food needs"; /* Create dummy variables corresponding to each year */ tabulate year, ge(yeard) nofreq; sum; log close; clear; #delimit cr