/* This file creates 3 variables for each ppn: * zeros82 = 1 if va, K, ph or ph2 are <=0 in 1982 * zeros87 in 1987 * zeros92 in 1992 * * zeros282 = 1 if obs4 or obs480 <10 in 1982 * zeros287 * zeros292 * * This file will be merged with st828792; * * Tto obtain a * balanced panel, simply delete any obs for which * zeros82=1 or zeros87=1 or zeros92=1 *****************************************************/ options compress=no; libname in 'D:/cm/'; libname un 'D:/enrico/new/data'; libname on 'D:/enrico/imported/data'; data tmp82; set in.st828792; if yr ^=82 then delete; K = bae+mae; ph2 = (ph/pw)*(te-pw); zeros82 =0; zeros282 =0; if va <=0 then zeros82=1; if ph <=0 then zeros82=1; if ph2 <=0 or ph2 =. then zeros82=1; if K <=0 or K=. then zeros82=1; if medu4 =. or medu6 =. then zeros82=1; if medu480 =. or medu680 =. then zeros82=1; if obs4<10 or obs480 <10 then zeros282 =1; keep ppn zeros82 zeros282; proc sort; by ppn; data tmp87; set in.st828792; if yr ^=87 then delete; zeros87 =0; zeros287 =0; K = bae+mae; ph2 = (ph/pw)*(te-pw); if va <=0 then zeros87=1; if ph <=0 then zeros87=1; if ph2 <=0 or ph2 =. then zeros87=1; if K <=0 or K=. then zeros87=1; if medu4 =. or medu6 =. then zeros87=1; if medu480 =. or medu680 =. then zeros87=1; if obs4<10 or obs480 <10 then zeros287 =1; keep ppn zeros87 zeros287; proc sort; by ppn; data tmp92; set in.st828792; if yr ^=92 then delete; K = bae+mae; ph2 = (ph/pw)*(te-pw); zeros92 =0; zeros292 =0; if va <=0 then zeros92=1; if ph <=0 then zeros92=1; if ph2 <=0 or ph2 =. then zeros92=1; if K <=0 or K=. then zeros92=1; if medu4 =. or medu6 =. then zeros92=1; if medu480 =. or medu680 =. then zeros92=1; if obs4<10 or obs480 <10 then zeros292 =1; keep ppn zeros92 zeros292; proc sort; by ppn; data in.errors2; merge tmp82 tmp87 tmp92; by ppn; proc means;