$ sas/linesize=80 *options linesize=80; * this program makes one new roster from the first and second child's rosters in the 92-93 primary respondent survey.; * each entry from the first child's roster is checked and added to the new roster if it is a valid entry. Then valid entries from the second child's roster are also added to the new roster. The century month of birth is checked for each entry in the new roster. Each entry in the new roster is ordered from oldest to youngest child. The name of the child is also carried along in the new roster so that name matching can be done for the intertransfer section; * variables in the new roster are: chsex sex of child chname name of child (only for private version) chrel relationship of child to respondent chmar marital status cheduc highest year of school attended chcomp complete this year chlive living arrangement chcmb century month of birth ; data kidros; length tmpa $ 1; length tmpal $ 15; length tmpa2 $ 2; array vcnam {15} $ 15; /* name from first roster */ array vcsex {15} $ 1; /* sex from first roster */ array v100s {15} 3; /* bio or not from first roster */ array v100t {15} 3; /* relationship from 1st roster if not bio */ array v94p {15} $1; /* valid entry - 1st roster */ array chsex {15} $1; /* child sex for new roster */ array chname{15} $15; /* name of child for new roster */ array chrel{15} 3; /* relationship of child for new roster */ array vdead{15} 3; /* was child known to be dead in 75 */ array chmort{15} 3; /* is child alive for new roster */ array chlive {15} $2; /* liveing arrangement of child for new roster */ array v104t{15} $1; /* where child live 1st roster */ array v102m{15} 3; /* month of child's death 1st roster */ array v102s{15} 3; /* year of child's death 1st roster */ array chdimn{15} 3; /* month of child's death new roster */ array chdiyr{15} 3; /* year of child's death new roster */ * second child's roster variables *****; array v120f{15} $1; /* child's sex */ array n120{15} $15; /* child's name */ array v124f{15} 3; /* bio ? */ array v124g{15} 3; /* relationship if not bio */ array v126g{15} $ 1; /* living arrangement */ array n126{15} 3; /* month of death */ array v126f {15} 3; /* year of death */ array n110{15} 3; /* marital status for 1st roster */ array chmar{15} 3; /* marital status for new child roster */ array n131{15} 3; /* marital status for 2nd roster */ array n114{15} 3; /* child's higest grade from 1st roster */ array cheduc {15} 3; /* child's highest grad new roster */ array chcomp {15} $ 1; /* child complete highest grade new roster */ array v114f {15} $ 1; /* child complete grade 1st roster */ array n136 {15} 3; /* child's highest grade 2nd roster */ array v136f {15} $ 1; /* child complete higest grade 2nd roster */ array v114m {15} 3; /* attend school in past 12 months , 1st roster */ array n116 {15} 3; /* live with r while school in session, 1st roster */ array v116a {15} 3; /* live with r while school not in session, 2nd roster */ array chschl {15} 3; /* attend school past 12 months, new roster */ array chshlv {15} 3; /* where live school in session, new roster */ array v136m {15} 3; /* attend school past 12 months, 2nd roster */ array n138 {15} 3; /* live with R while in school, 2nd roster */ array v138a {15} 3; /* live with R while not in school, 2nd roster*/ array K {15} 3; /* month of kid's birth, 1st roster */ array vcyr{15} 3; /* year of kid's birth, 1st roster */ array v96m{15} 3; /* month if correction */ array v96s{15} 3; /* year if correction */ array v120p {15} 3; /* month of kid's birth, 2nd roster */ array v120s {15} 3; /* year of kid's birth, 2nd roster */ array chcmb {15} 4; /* century month of child's birth new roster */ array org {15} 3; /* child from roster 1 or roster 2 */ length sklive $ 2; length sksex $ 1; *keep idswl chsex1 -- chsex14 chrel1 -- chrel14 chmort1 -- chmort14 chdimn1 -- chdimn14 chdiyr1 -- chdiyr14 chlive1 -- chlive14 chmar1 -- chmar14 cheduc1 -- cheduc14 chcomp1 -- chcomp14 chschl1 -- chschl14 chshlv1 -- chshlv14 chcmb1 -- chcmb14 org1 -- org14 sknew sksex skrel sklive skmar skeduc skcomp skschl skshlv skcmb skord skorg kidsno92 chname1 -- chname14; infile 'projdisk11:[231070]refcum.dat'; input idswl 1-6 in75 31-32 xs77 33-34 gp91 37 ckkd 967-968 vskn $ 3727-3741 vska 3746-3749 v118f 3602- 3602 v118g 3603- 3603 v118q 3610- 3611 v92m $ 3538- 3538 v120f1 $ 9851- 9851 v120f2 $ 9917- 9917 v120f3 $ 9983- 9983 v120f4 $ 10049-10049 v120f5 $ 10115-10115 v120f6 $ 10181-10181 v120f7 $ 10247-10247 v120f8 $ 10313-10313 v120f9 $ 10379-10379 v120f10 $ 10445-10445 v120f11 $ 10511-10511 v120f12 $ 10577-10577 v120f13 $ 10643-10643 v120f14 $ 10709-10709 v120f15 $ 10775-10775 n1201 $ 9821- 9835 n1202 $ 9887- 9901 n1203 $ 9953- 9967 n1204 $ 10019-10033 n1205 $ 10085-10099 n1206 $ 10151-10165 n1207 $ 10217-10231 n1208 $ 10283-10297 n1209 $ 10349-10363 n12010 $ 10415-10429 n12011 $ 10481-10495 n12012 $ 10547-10561 n12013 $ 10613-10627 n12014 $ 10679-10693 n12015 $ 10745-10759 v126g1 $ 9872- 9872 v126g2 $ 9938- 9938 v126g3 $ 10004-10004 v126g4 $ 10070-10070 v126g5 $ 10136-10136 v126g6 $ 10202-10202 v126g7 $ 10268-10268 v126g8 $ 10334-10334 v126g9 $ 10400-10400 v126g10 $ 10466-10466 v126g11 $ 10532-10532 v126g12 $ 10598-10598 v126g13 $ 10664-10664 v126g14 $ 10730-10730 v126g15 $ 10796-10796 n1261 9873- 9874 n1262 9939- 9940 n1263 10005-10006 n1264 10071-10072 n1265 10137-10138 n1266 10203-10204 n1267 10269-10270 n1268 10335-10336 n1269 10401-10402 n12610 10467-10468 n12611 10533-10534 n12612 10599-10600 n12613 10665-10666 n12614 10731-10732 n12615 10797-10798 v126f1 9875- 9876 v126f2 9941- 9942 v126f3 10007-10008 v126f4 10073-10074 v126f5 10139-10140 v126f6 10205-10206 v126f7 10271-10272 v126f8 10337-10338 v126f9 10403-10404 v126f10 10469-10470 v126f11 10535-10536 v126f12 10601-10602 v126f13 10667-10668 v126f14 10733-10734 v126f15 10799-10800 v124f1 9870- 9870 v124f2 9936- 9936 v124f3 10002-10002 v124f4 10068-10068 v124f5 10134-10134 v124f6 10200-10200 v124f7 10266-10266 v124f8 10332-10332 v124f9 10398-10398 v124f10 10464-10464 v124f11 10530-10530 v124f12 10596-10596 v124f13 10662-10662 v124f14 10728-10728 v124f15 10794-10794 v124g1 9871- 9871 v124g2 9937- 9937 v124g3 10003-10003 v124g4 10069-10069 v124g5 10135-10135 v124g6 10201-10201 v124g7 10267-10267 v124g8 10333-10333 v124g9 10399-10399 v124g10 10465-10465 v124g11 10531-10531 v124g12 10597-10597 v124g13 10663-10663 v124g14 10729-10729 v124g15 10795-10795 vdead1 8561- 8561 vdead2 8645- 8645 vdead3 8729- 8729 vdead4 8813- 8813 vdead5 8897- 8897 vdead6 8981- 8981 vdead7 9065- 9065 vdead8 9149- 9149 vdead9 9233- 9233 vdead10 9317- 9317 vdead11 9401- 9401 vdead12 9485- 9485 vdead13 9569- 9569 vdead14 9653- 9653 vdead15 9737- 9737 vcnam1 $ 8567- 8581 vcsex1 $ 8582- 8582 v94p1 8603- 8603 v94s1 8604- 8604 n961 8605- 8605 v96f1 8606- 8606 v96m1 8607- 8608 v96s1 8609- 8610 v100s1 8627- 8627 v100t1 8628- 8628 v104s1 8629- 8629 v102f1 8630- 8630 v104t1 $ 8631- 8631 v102m1 8632- 8633 v102s1 8634- 8635 n1101 8636- 8636 n1141 8637- 8638 v114f1 8641- 8641 v114m1 8642- 8642 n1161 8643- 8643 v116a1 8644- 8644 vcnam2 $ 8651- 8665 vcsex2 $ 8666- 8666 v94p2 8687- 8687 v94s2 8688- 8688 n962a 8689- 8689 v96f2 8690- 8690 v96m2 8691- 8692 v96s2 8693- 8694 n982 8695- 8695 v98f2 $ 8696- 8710 v100s2 8711- 8711 v100t2 8712- 8712 v104s2 8713- 8713 v102f2 8714- 8714 v104t2 $ 8715- 8715 v102m2 8716- 8717 v102s2 8718- 8719 n1102 8720- 8720 n1142 8721- 8722 v114f2 8725- 8725 v114m2 8726- 8726 n1162 8727- 8727 v116a2 8728- 8728 vcnam3 $ 8735- 8749 vcsex3 $ 8750- 8750 v94p3 8771- 8771 v94s3 8772- 8772 n963 8773- 8773 v96f3 8774- 8774 v96m3 8775- 8776 v96s3 8777- 8778 n983 8779- 8779 v98f3 $ 8780- 8794 v100s3 8795- 8795 v100t3 8796- 8796 v104s3 8797- 8797 v102f3 8798- 8798 v104t3 $ 8799- 8799 v102m3 8800- 8801 v102s3 8802- 8803 n1103 8804- 8804 n1143 8805- 8806 v114f3 8809- 8809 v114m3 8810- 8810 n1163 8811- 8811 v116a3 8812- 8812 vcnam4 $ 8819- 8833 vcsex4 $ 8834- 8834 v94p4 8855- 8855 v94s4 8856- 8856 n964 8857- 8857 v96f4 8858- 8858 v96m4 8859- 8860 v96s4 8861- 8862 n984 8863- 8863 v98f4 $ 8864- 8878 v100s4 8879- 8879 v100t4 8880- 8880 v104s4 8881- 8881 v102f4 8882- 8882 v104t4 $ 8883- 8883 v102m4 8884- 8885 v102s4 8886- 8887 n1104 8888- 8888 n1144 8889- 8890 v114f4 8893- 8893 v114m4 8894- 8894 n1164 8895- 8895 v116a4 8896- 8896 vcnam5 $ 8903- 8917 vcsex5 $ 8918- 8918 v94p5 8939- 8939 v94s5 8940- 8940 n965 8941- 8941 v96f5 8942- 8942 v96m5 8943- 8944 v96s5 8945- 8946 n985 8947- 8947 v98f5 $ 8948- 8962 v100s5 8963- 8963 v100t5 8964- 8964 v104s5 8965- 8965 v102f5 8966- 8966 v104t5 $ 8967- 8967 v102m5 8968- 8969 v102s5 8970- 8971 n1105 8972- 8972 n1145 8973- 8974 v114f5 8977- 8977 v114m5 8978- 8978 n1165 8979- 8979 v116a5 8980- 8980 vcnam6 $ 8987- 9001 vcsex6 $ 9002- 9002 vcage6 9003- 9006 v94p6 9023- 9023 v94s6 9024- 9024 n966 9025- 9025 v96f6 9026- 9026 v96m6 9027- 9028 v96s6 9029- 9030 n986 9031- 9031 v98f6 $ 9032- 9046 v100s6 9047- 9047 v100t6 9048- 9048 v104s6 9049- 9049 v102f6 9050- 9050 v104t6 $ 9051- 9051 v102m6 9052- 9053 v102s6 9054- 9055 n1106 9056- 9056 n1146 9057- 9058 v114f6 9061- 9061 v114m6 9062- 9062 n1166 9063- 9063 v116a6 9064- 9064 vcnam7 $ 9071- 9085 vcsex7 $ 9086- 9086 v94p7 9107- 9107 v94s7 9108- 9108 n967 9109- 9109 v96f7 9110- 9110 v96m7 9111- 9112 v96s7 9113- 9114 n987 9115- 9115 v98f7 $ 9116- 9130 v100s7 9131- 9131 v100t7 9132- 9132 v104s7 9133- 9133 v102f7 9134- 9134 v104t7 $ 9135- 9135 v102m7 9136- 9137 v102s7 9138- 9139 n1107 9140- 9140 n1147 9141- 9142 v114f7 9145- 9145 v114m7 9146- 9146 n1167 9147- 9147 v116a7 9148- 9148 vcnam8 $ 9155- 9169 vcsex8 $ 9170- 9170 vcold8 9186- 9186 v94p8 9191- 9191 v94s8 9192- 9192 n968 9193- 9193 v96f8 9194- 9194 v96m8 9195- 9196 v96s8 9197- 9198 n988 9199- 9199 v98f8 $ 9200- 9214 v100s8 9215- 9215 v100t8 9216- 9216 v104s8 9217- 9217 v102f8 9218- 9218 v104t8 $ 9219- 9219 v102m8 9220- 9221 v102s8 9222- 9223 n1108 9224- 9224 n1148 9225- 9226 v114f8 9229- 9229 v114m8 9230- 9230 n1168 9231- 9231 v116a8 9232- 9232 vcnam9 $ 9239- 9253 vcsex9 $ 9254- 9254 v94p9 9275-9275 v94s9 9276- 9276 n969 9277- 9277 v96f9 9278- 9278 v96m9 9279- 9280 v96s9 9281- 9282 n989 9283- 9283 v98f9 $ 9284- 9298 v100s9 9299- 9299 v100t9 9300- 9300 v104s9 9301- 9301 v102f9 9302- 9302 v104t9 $ 9303- 9303 v102m9 9304- 9305 v102s9 9306- 9307 n1109 9308- 9308 n1149 9309- 9310 v114f9 9313- 9313 v114m9 9314- 9314 n1169 9315- 9315 v116a9 9316- 9316 vcnam10 $ 9323- 9337 vcsex10 $ 9338- 9338 v94p10 9359- 9359 v94s10 9360- 9360 n9610 9361- 9361 v96f10 9362- 9362 v96m10 9363- 9364 v96s10 9365- 9366 n9810 9367- 9367 v98f10 $ 9368- 9382 v100s10 9383- 9383 v100t10 9384- 9384 v104s10 9385- 9385 v102f10 9386- 9386 v104t10 $ 9387- 9387 v102m10 9388- 9389 v102s10 9390- 9391 n11010 9392- 9392 n11410 9393- 9394 v114f10 9397- 9397 v114m10 9398- 9398 n11610 9399- 9399 v116a10 9400- 9400 vcnam11 $ 9407- 9421 vcsex11 $ 9422- 9422 v94p11 9443- 9443 v94s11 9444- 9444 n9611 9445- 9445 v96f11 9446- 9446 v96m11 9447- 9448 v96s11 9449- 9450 n9811 9451- 9451 v98f11 $ 9452- 9466 v100s11 9467- 9467 v100t11 9468- 9468 v104s11 9469- 9469 v102f11 9470- 9470 v104t11 $ 9471- 9471 v102m11 9472- 9473 v102s11 9474- 9475 n11011 9476- 9476 n11411 9477- 9478 v114f11 9481- 9481 v114m11 9482- 9482 n11611 9483- 9483 v116a11 9484- 9484 vcnam12 $ 9491- 9505 vcsex12 $ 9506- 9506 v75ag12 9523- 9526 v94p12 9527- 9527 v94s12 9528- 9528 n9612 9529- 9529 v96f12 9530- 9530 v96m12 9531- 9532 v96s12 9533- 9534 n9812 9535- 9535 v98f12 $ 9536- 9550 v100s12 9551- 9551 v100t12 9552- 9552 v104s12 9553- 9553 v102f12 9554- 9554 v104t12 $ 9555- 9555 v102m12 9556- 9557 v102s12 9558- 9559 n11012 9560- 9560 n11412 9561- 9562 v114f12 9565- 9565 v114m12 9566- 9566 n11612 9567- 9567 v116a12 9568- 9568 vcnam13 $ 9575- 9589 vcsex13 $ 9590- 9590 v94p13 9611- 9611 v94s13 9612- 9612 n9613 9613- 9613 v96f13 9614- 9614 v96m13 9615- 9616 v96s13 9617- 9618 n9813 9619- 9619 v98f13 $ 9620- 9634 v100s13 9635- 9635 v100t13 9636- 9636 v104s13 9637- 9637 v102f13 9638- 9638 v104t13 $ 9639- 9639 v102m13 9640- 9641 v102s13 9642- 9643 n11013 9644- 9644 n11413 9645- 9646 v114f13 9649- 9649 v114m13 9650- 9650 n11613 9651- 9651 v116a13 9652- 9652 vcnam14 $ 9659- 9673 vcsex14 $ 9674- 9674 v94p14 9695- 9695 v94s14 9696- 9696 n9614 9697- 9697 v96f14 9698- 9698 v96m14 9699- 9700 v96s14 9701- 9702 n9814 9703- 9703 v98f14 $ 9704- 9718 v100s14 9719- 9719 v100t14 9720- 9720 v104s14 9721- 9721 v102f14 9722- 9722 v104t14 $ 9723- 9723 v102m14 9724- 9725 v102s14 9726- 9727 n11014 9728- 9728 n11414 9729- 9730 v114f14 9733- 9733 v114m14 9734- 9734 n11614 9735- 9735 v116a14 9736- 9736 vcnam15 $ 9743- 9757 vcsex15 $ 9758- 9758 v94p15 9779- 9779 v94s15 9780- 9780 n9615 9781- 9781 v96f15 9782- 9782 v96m15 9783- 9784 v96s15 9785- 9786 n9815 9787- 9787 v98f15 $ 9788- 9802 v100s15 9803- 9803 v100t15 9804- 9804 v104s15 9805- 9805 v102f15 9806- 9806 v104t15 $ 9807- 9807 v102m15 9808- 9809 v102s15 9810- 9811 n11015 9812- 9812 n11415 9813- 9814 v114f15 9817- 9817 v114m15 9818- 9818 n11615 9819- 9819 v116a15 9820- 9820 n1311 9878- 9878 n1312 9944- 9944 n1313 10010-10010 n1314 10076-10076 n1315 10142-10142 n1316 10208-10208 n1317 10274-10274 n1318 10340-10340 n1319 10406-10406 n13110 10472-10472 n13111 10538-10538 n13112 10604-10604 n13113 10670-10670 n13114 10736-10736 n13115 10802-10802 n1361 9879- 9880 n1362 9945- 9946 n1363 10011-10012 n1364 10077-10078 n1365 10143-10144 n1366 10209-10210 n1367 10275-10276 n1368 10341-10342 n1369 10407-10408 n13610 10473-10474 n13611 10539-10540 n13612 10605-10606 n13613 10671-10672 n13614 10737-10738 n13615 10803-10804 v136f1 9883- 9883 v136f2 9949- 9949 v136f3 10015-10015 v136f4 10081-10081 v136f5 10147-10147 v136f6 10213-10213 v136f7 10279-10279 v136f8 10345-10345 v136f9 10411-10411 v136f10 10477-10477 v136f11 10543-10543 v136f12 10609-10609 v136f13 10675-10675 v136f14 10741-10741 v136f15 10807-10807 v136m1 9884- 9884 v136m2 9950- 9950 v136m3 10016-10016 v136m4 10082-10082 v136m5 10148-10148 v136m6 10214-10214 v136m7 10280-10280 v136m8 10346-10346 v136m9 10412-10412 v136m10 10478-10478 v136m11 10544-10544 v136m12 10610-10610 v136m13 10676-10676 v136m14 10742-10742 v136m15 10808-10808 n1381 9885- 9885 n1382 9951- 9951 n1383 10017-10017 n1384 10083-10083 n1385 10149-10149 n1386 10215-10215 n1387 10281-10281 n1388 10347-10347 n1389 10413-10413 n13810 10479-10479 n13811 10545-10545 n13812 10611-10611 n13813 10677-10677 n13814 10743-10743 n13815 10809-10809 v138a1 9886- 9886 v138a2 9952- 9952 v138a3 10018-10018 v138a4 10084-10084 v138a5 10150-10150 v138a6 10216-10216 v138a7 10282-10282 v138a8 10348-10348 v138a9 10414-10414 v138a10 10480-10480 v138a11 10546-10546 v138a12 10612-10612 v138a13 10678-10678 v138a14 10744-10744 v138a15 10810-10810 K1 1121- 1122 K2 1123- 1124 K3 1125- 1126 K4 1127- 1128 K5 1129- 1130 K6 1131- 1132 K7 1133- 1134 K8 1135- 1136 K9 1137- 1138 K10 1139- 1140 K11 1141- 1142 K12 1143- 1144 K13 1145- 1146 K14 1147- 1148 K15 1149- 1150 vcyr1 8565- 8566 vcyr2 8649- 8650 vcyr3 8733- 8734 vcyr4 8817- 8818 vcyr5 8901- 8902 vcyr6 8985- 8986 vcyr7 9069- 9070 vcyr8 9153- 9154 vcyr9 9237- 9238 vcyr10 9321- 9322 vcyr11 9405- 9406 vcyr12 9489- 9490 vcyr13 9573- 9574 vcyr14 9657- 9658 vcyr15 9741- 9742 v120p1 9858- 9859 v120p2 9924- 9925 v120p3 9990- 9991 v120p4 10056-10057 v120p5 10122-10123 v120p6 10188-10189 v120p7 10254-10255 v120p8 10320-10321 v120p9 10386-10387 v120p10 10452-10453 v120p11 10518-10519 v120p12 10584-10585 v120p13 10650-10651 v120p14 10716-10717 v120p15 10782-10783 v120s1 9860- 9861 v120s2 9926- 9927 v120s3 9992- 9993 v120s4 10058-10059 v120s5 10124-10125 v120s6 10190-10191 v120s7 10256-10257 v120s8 10322-10323 v120s9 10388-10389 v120s10 10454-10455 v120s11 10520-10521 v120s12 10586-10587 v120s13 10652-10653 v120s14 10718-10719 v120s15 10784-10785 zelda 12033 cmint92 12034-12037 ; if zelda ne 2; n=0; /* total number of children in new roster */ * if respondent refuses to talk about any children, 94p1 will be 0; if v94p1 eq '0' then do; i = 1; do while (i le 15); org{i} = 9; chsex{i} = '9'; chrel{i}=99; chname{i}=' '; chmort{i}=9; chlive{i}='99'; chdimn{i}=99; chdiyr{i}=99; chmar{i}=9; cheduc{i}=99; chcomp{i}='9'; chschl{i}=9; chshlv{i}=9; chcmb{i}=9999; i = i + 1; end; /* do while i le 15 */ kidsno92=99; n=99; /* no kids info */ end; /* if 94p1 eq 0 */ else if v92m ne ' ' then do; /* 75 respondent with kids */ i = 1; * put valid entries from the first child's roster in the new child's roster ; do while (i le 15); if v94p{i} ne '5' and v94p{i} ne ' ' then do; n = n + 1; /* found valid entry, add 1 to counter */ * save org; org{n} = 1; * get child's sex; if vcsex{i} eq '1' or vcsex{i} eq 'M' then chsex{n} = '1'; else if vcsex{i} eq '2' or vcsex{i} eq 'F' then chsex{n} = '2'; else if vcsex{i} eq '8' then chsex{n} = '7'; else if vcsex{i} eq '9' or vcsex{i} eq 'U' then chsex{n} = '9'; else chsex{n} = '9'; * get child's name; * original are uppercase, left - justified. updates have leading 0's and sometimes a /, so remove all 0's and /; chname{n} = upcase(compress(vcnam{i},'0/')); * get child's relationship; if v100s{i} eq 1 then chrel{n}=0; else if v100s{i} eq 8 then chrel{n} = 97; /* don't know */ else if v100s{i} eq 9 then chrel{n}=99; /* refused */ else if v100t{i} eq 0 then chrel{n}=8; /* child of lover/partner */ else if v100t{i} eq 8 then chrel{n}=97; /* don't know */ else if v100t{i} eq 9 then chrel{n} = 99; /* refused */ else if v100t{i} ge 1 and v100t{i} le 7 then chrel{n} = v100t{i}; else chrel{n} = 99; /* missing */ * get child's mortality status ; * dead contains mortality status collected in 75 ; if vdead{i} eq 1 then do; /* child known to be dead in 75 */ chmort{n}=2; chlive{n}='05'; chdimn{n}=96; /* don't know, but prior to 75 interview */ chdiyr{n}=96; /* don't know, but prior to 75 interview */ end; /* if vdead{i} eq 1 */ * 104t contains mortality status collected in 92-93; else do; /* check 104t */ if v104t{i} eq '5' then chmort{n}=2; /* deceased */ else chmort{n}=1; /* alive */ * construct living arrangement variable; if v104t{i} eq '0' then chlive{n}='08'; else if v104t{i} eq '3' then chlive{n} = '14'; else if v104t{i} eq '8' then chlive{n}='97'; else if v104t{i} eq '9' then chlive{n}='99'; else if v104t{i} eq 'a' then chlive{n}='09'; else if v104t{i} eq 'b' then chlive{n}='10'; else if v104t{i} eq 'c' then chlive{n} = '11'; else if v104t{i} eq 'd' then chlive{n}='12'; else if v104t{i} eq 'e' then chlive{n}='13'; else if v104t{i} eq 'f' then chlive{n} = '03'; else chlive{n} = '0' || v104t{i}; /* put leading 0 in front of org 104t*/ * month of child's death; if v102m{i} eq 98 then chdimn{n}=97; else if v102m{i} eq . then chdimn{n}=95; /* alive */ else chdimn{n} = v102m{i}; * year of child's death; if v102s{i} eq 98 then chdiyr{n} = 97; else if v102s{i} eq . then chdiyr{n} = 95; /* alive */ else chdiyr{n} = v102s{i}; end; /* else do */ * marital status; if n110{i} eq 8 then chmar{n} = 7; else if n110{i} eq . then chmar{n} = 8; else chmar{n}=n110{i}; * highest grade attended; if n114{i} eq 98 then cheduc{n}=97; else if n114{i} eq . then cheduc{n} = 98; else cheduc{n}=n114{i}; * completed; if n114{i} eq 32 or v114f{i} eq ' ' then chcomp{n}='8'; else if v114f{i} eq '8' then chcomp{n} = '7'; else chcomp{n}=v114f{i}; * attend school past 12 months ; if v114m{i} eq 8 then do; chschl{n} = 7; chshlv{n} = 7; end; else if v114m{i} eq . then do; chschl{n} = 8; /* child deceased inap */ chshlv{n} = 8; end; else if v114m{i} eq 9 then do; chschl{n}=9; chshlv{n}=9; end; else if v114m{i} eq 2 then do; /* no */ chschl{n} = 2; chshlv{n}=8; end; else if v114m{i} eq 1 then do; /* yes */ chschl{n}=1; if n116{i} eq 1 then chshlv{n}=1; else if n116{i} eq 8 then chshlv{n}=7; else if n116{i} eq 9 then chshlv{n}=9; else if v116a{i} eq 1 then chshlv{n}=2; else if v116a{i} eq 2 then chshlv{n}=3; else if v116a{i} eq 8 then chshlv{n}=7; else if v116a{i} eq 9 then chshlv{n} =9; end; * century month of child's birth; * if correction, then use that; if v96m{i} ne . then do; if v96s{i} eq 98 then chcmb{n}=9997; /* don't know year*/ else if v96s{i} eq 99 then chcmb{n} = 9999; /* refused year */ else do; /* year present, calculate age */ if v96m{i} eq 98 or v96m{i} eq 99 then chcmb{n} = v96s{i}*12+6; /* use 6 for month */ else chcmb{n} = v96s{i}*12+v96m{i}; end; /* year present, calculate age */ end; /* end if v96m ne ' ' */ else if vcyr{i} eq 99 then chcmb{n}=9999; /* missing */ else if k{i} eq 99 then chcmb{n}=12*vcyr{i}+6; /* use 6 for month */ else chcmb{n}=12*vcyr{i}+k{i}; /* valid month and year */ *; if chcmb{n} > cmint92 and chcmb{n} lt 9900 then chcmb{n} = 9999; /* if data in error, make miss */ end; /* if 94p {i} ne '5' and 94p ne ' ' */ i = i + 1; end; /* do while i le 15 */ end; /* if 92m ne ' ' */ * check second child's roster for children to be added; if v118g eq 9 or v118f eq 9 or v118q eq 99 or v118g eq 8 then do; /*refusal */ n = n + 1; do while (n le 15); org{n} = 9; chsex{n}='9'; chrel{n}=99; chname{n} = ' '; chmort{n}=9; chlive{n}='99'; chdimn{n}=99; chdiyr{n}=99; chmar{n}=9; cheduc{n}=99; chcomp {n}='9'; chschl{n}=9; chshlv{n}=9; chcmb{n}=9999; n = n + 1; end; /* do while n le 15 */ n=99; /* refusal for total number of kids */ end; /* if 118g eq 9 or 118f eq 9 or 118q eq 99 or 118g eq 8 */ else if v118f eq 1 or v118g eq 1 then do; * check each entry; i = 1; do while (i le 15); * if sex is x or y then this child should be skipped; if v120f{i} ne 'x' and v120f{i} ne 'z' and v120f{i} ne ' ' then do; n=n+1; /* another child to add */ * get org; org{n} = 2; * get child's sex; if v120f{i} eq '8' then chsex{n}='7'; else chsex{n}=v120f{i}; * get child's name; chname{n}=upcase(compress(n120{i},'0/')); * get child's relationship; if v124f{i} eq 1 then chrel{n}=0; else if v124f{i} eq 8 then chrel{n} = 97; /* don't know */ else if v124f{i} eq 9 then chrel{n}=99; /* refused */ else if v124g{i} eq 0 then chrel{n}=8; /* child of lover/partner */ else if v124g{i} eq 8 then chrel{n}=97; /* don't know */ else if v124g{i} eq 9 then chrel{n} = 99; /* refused */ else if v124g{i} ge 1 and v124g{i} le 7 then chrel{n} = v124g{i}; else chrel{n} = 99; /* missing */ * 126g contains mortality status; if v126g{i} eq '5' then chmort{n}=2; /* deceased */ else chmort{n}=1; /* alive */ * construct living arrangement variable; if v126g{i} eq '0' then chlive{n}='08'; else if v126g{i} eq '3' then chlive{n} = '14'; else if v126g{i} eq '8' then chlive{n}='97'; else if v126g{i} eq '9' then chlive{n}='99'; else if v126g{i} eq 'a' then chlive{n}='09'; else if v126g{i} eq 'b' then chlive{n}='10'; else if v126g{i} eq 'c' then chlive{n} = '11'; else if v126g{i} eq 'd' then chlive{n}='12'; else if v126g{i} eq 'e' then chlive{n}='13'; else if v126g{i} eq 'f' then chlive{n} = '03'; else if v126g{i} eq '1' then chlive{n}='02'; /* lives with r */ else if v126g{i} eq '2' then chlive{n} = '01'; /* lives on own */ else chlive{n} = '0' || v126g{i}; /* put leading 0 in front of org 126g*/ * month of child's death; if n126{i} eq 98 then chdimn{n}=97; else if n126{i} eq . then chdimn{n}=95; /* alive */ else chdimn{n} = n126{i}; * year of child's death; if v126f{i} eq 98 then chdiyr{n} = 97; else if v126f{i} eq . then chdiyr{n} = 95; /* alive */ else chdiyr{n} = v126f{i}; * marital status; if n131{i} eq 8 then chmar{n} = 7; else if n131{i} eq . then chmar{n} = 8; else chmar{n}=n131{i}; * higest year of school; if n136{i} eq 95 then cheduc{n} = 96; else if n136{i} eq 98 then cheduc{n}=97; else if n136{i} eq . then cheduc{n} = 98; else cheduc{n}=n136{i}; * completed; if n136{i} eq 32 or v136f{i} eq ' ' then chcomp{n}='8'; else if v136f{i} eq '8' then chcomp{n} = '7'; else chcomp{n}=v136f{i}; * attend school past 12 months ; if v136m{i} eq 8 then do; chschl{n} = 7; chshlv{n} = 7; end; else if v136m{i} eq . then do; chschl{n} = 8; /* child deceased inap */ chshlv{n} = 8; end; else if v136m{i} eq 9 then do; chschl{n}=9; chshlv{n}=9; end; else if v136m{i} eq 2 then do; /* no */ chschl{n}=2; chshlv{n}=8; end; else if v136m{i} eq 1 then do; chschl{n}=1; if n138{i} eq 1 then chshlv{n}=1; else if n138{i} eq 8 then chshlv{n}=7; else if n138{i} eq 9 then chshlv{n}=9; else if v138a{i} eq 1 then chshlv{n}=2; else if v138a{i} eq 2 then chshlv{n}=3; else if v138a{i} eq 8 then chshlv{n}=7; else if v138a{i} eq 9 then chshlv{n} =9; end; * calcuate century month of child's birth; if v120s{i} eq 99 then chcmb{n}=9999; /* year refused */ else if v120s{i} eq 98 then chcmb{n}=9997; /* year don't know */ else if v120p{i} eq 99 or v120p{i} eq 98 then chcmb{n}=12*v120s{i}+6;/* use 6*/ else chcmb{n}=12*v120s{i}+v120p{i}; /* valid month and year */ end; /* if 120f ne x and 120f ne z and 120f ne ' ' */ i = i + 1; end; /* do while i le 15 */ end; /* if v118v eq 1 or 118g eq 1 */ kidsno92=n; * fill in with inaps; n = n + 1; do while (n le 15); org{n}=8; chsex{n}='8'; chrel{n}=98; chname{n} = ' '; chmort{n}=8; chlive{n}='98'; chdimn{n}=98; chdiyr{n}=98; chmar{n}=8; cheduc{n}=98; chcomp{n}='8'; chschl{n}=8; chshlv{n}=8; chcmb{n}=9998; n = n + 1; end; /* do while n le 15 */ * check for ages out of order and reorder if necessary ; if kidsno92 gt 1 and kidsno92 lt 20 then do; /* at least two kids in table */ * swith any pairs that are out of order. If switch occurs check again for more out of order, if no switch, then done; swi = 1; /* set swith to 1, so check first time */ do while (swi eq 1); /* check for more */ i=1; do while (i lt kidsno92); swi = 0; /* set swith to 0 so checking stops if no more switches */ if chcmb{i+1} lt 9900 and chcmb{i} gt chcmb{i+1} then do; tmpn = org{i}; org{i}=org{i+1}; org{i+1}=tmpn; tmpn = chcmb{i}; chcmb{i} = chcmb{i+1}; chcmb{i+1}=tmpn; tmpa=chsex{i}; chsex{i}=chsex{i+1}; chsex{i+1}=tmpa; tmpn= chrel{i}; chrel{i}=chrel{i+1}; chrel{i+1}=tmpn; tmpal=chname{i}; chname{i}=chname{i+1}; chname{i+1}=tmpal; tmpn=chmort{i}; chmort{i}=chmort{i+1}; chmort{i+1}=tmpn; tmpa2= chlive{i}; chlive{i}=chlive{i+1}; chlive{i+1}=tmpa2; tmpn= chdimn{i}; chdimn{i}=chdimn{i+1}; chdimn{i+1}=tmpn; tmpn= chdiyr{i}; chdiyr{i}=chdiyr{i+1}; chdiyr{i+1}=tmpn; tmpn= chmar{i}; chmar{i}=chmar{i+1}; chmar{i+1}=tmpn; tmpn= cheduc{i}; cheduc{i}=cheduc{i+1}; cheduc{i+1}=tmpn; tmpa=chcomp{i}; chcomp{i}=chcomp{i+1}; chcomp{i+1}=tmpa; tmpn=chschl{i}; chschl{i}=chschl{i+1}; chschl{i+1}=tmpn; tmpn= chshlv{i}; chshlv{i}=chshlv{i+1}; chshlv{i+1}=tmpn; swi=1; i=kidsno92; /* go back to beginning to check for switches */ end; /* if chcmb{i+1} lt 9900 and chcmb{i+1} lt chcmb{i}*/ i=i+1; end; /* do while (i lt kidno92) */ end; /* if swi eq 1 */ end; /* if numkids92 gt 1 ... */ * get selected kid; if kidsno92 eq 99 and chrel1 eq 99 then do; skorg = 9; sknew=9; sklive='99'; sksex = '9'; skcmb=9999; skrel = 99; skmar=9; skord=99; skeduc=99; skcomp='9'; skschl=9; skshlv=9; mtch = 99; end; /* if kidsno92 eq 99 and chrel1 eq 99 */ else if kidsno92 eq 0 or vskn eq ' ' then do; skorg = 8; sknew=8; sklive='98'; sksex = '8'; skcmb=9998; skrel = 98; skmar=8; skord=98; skeduc=98; skschl=8; skshlv=8; skcomp='8'; mtch = 98; end; else do; /* put in skid information, first find who */ * see if 75 kid is same; if ckkd lt 15 and ckkd gt 0 then do; if vcnam{ckkd} eq vskn then do; sknew = 1; cmb=vcyr{ckkd}*12 + k{ckkd}; end; /* if vcnam eq vskn */ else do; /* figure out why new kid selected */ if vdead{ckkd} eq 1 then sknew=4; else if v104t{ckkd} eq '5' then sknew = 4; /* dead */ else if v104t{ckkd} eq '8' then sknew = 7; /* don't know child stat */ else if (gp91 eq 0 or gp91 eq 1) and xs77 eq 99 then sknew = 5; end; end; /* if ckkd lt 15 */ else do; if in75 ne 1 then sknew = 2; /* not in 75 samp */ else if ckkd eq 88 or ckkd eq 99 then sknew = 3; end; mtch = 0; vskn = upcase(compress(vskn,'0/')); i = 1; if kidsno92 lt 15 then endp = kidsno92; else endp = 14; do while (i le endp); if vskn eq chname{i} then do; mtch = mtch + 1; ind = i; end; i = i + 1; end; /* do while i le endp */ if mtch gt 1 then do; * see which cmb matches selected kids ; i = 1; mtch2 = 0; do while (i le endp); if chcmb{i} eq cmb or vska eq int((cmint92-chcmb{i})/12) then do; ind = i; mtch2 = mtch2 + 1; end; i = i + 1; end; /* do while */ if idswl eq 720012 then do; ind = 3; mtch2 = 1; end; end; /* if mtch gt 1 */ * assign rest of selected kid variables ; skord=ind; /* position in table */ skorg=org{ind}; sksex=chsex{ind}; skrel=chrel{ind}; sklive=chlive{ind}; skmar=chmar{ind}; skeduc=cheduc{ind}; skcomp=chcomp{ind}; skschl=chschl{ind}; skshlv=chshlv{ind}; skcmb=chcmb{ind}; end; /* else do */ * make flags for 75 and 77; if in75 eq 1 then f75 =1; else f75 = 0; if xs77 eq 99 then f77 = 0; else f77 = 1; if gp91 eq 0 or gp91 eq 1 then fgp = 1; else fgp = 0; file 'projdisk11:[231070.dat]dkros.out'; put idswl 1-6 kidsno92 z2. chsex1 $ 1. chrel1 z2. chmort1 1. chdimn1 z2. chdiyr1 z2. chlive1 $ 2. chmar1 1. cheduc1 z2. chcomp1 $ 1. chschl1 1. chshlv1 1. chcmb1 z4. org1 1. chsex2 $ 1. chrel2 z2. chmort2 1. chdimn2 z2. chdiyr2 z2. chlive2 $ 2. chmar2 1. cheduc2 z2. chcomp2 $ 1. chschl2 1. chshlv2 1. chcmb2 z4. org2 1. chsex3 $ 1. chrel3 z2. chmort3 1. chdimn3 z2. chdiyr3 z2. chlive3 $ 2. chmar3 1. cheduc3 z2. chcomp3 $ 1. chschl3 1. chshlv3 1. chcmb3 z4. org3 1. chsex4 $ 1. chrel4 z2. chmort4 1. chdimn4 z2. chdiyr4 z2. chlive4 $ 2. chmar4 1. cheduc4 z2. chcomp4 $ 1. chschl4 1. chshlv4 1. chcmb4 z4. org4 1. chsex5 $ 1. chrel5 z2. chmort5 1. chdimn5 z2. chdiyr5 z2. chlive5 $ 2. chmar5 1. cheduc5 z2. chcomp5 $ 1. chschl5 1. chshlv5 1. chcmb5 z4. org5 1. chsex6 $ 1. chrel6 z2. chmort6 1. chdimn6 z2. chdiyr6 z2. chlive6 $ 2. chmar6 1. cheduc6 z2. chcomp6 $ 1. chschl6 1. chshlv6 1. chcmb6 z4. org6 1. chsex7 $ 1. chrel7 z2. chmort7 1. chdimn7 z2. chdiyr7 z2. chlive7 $ 2. chmar7 1. cheduc7 z2. chcomp7 $ 1. chschl7 1. chshlv7 1. chcmb7 z4. org7 1. chsex8 $ 1. chrel8 z2. chmort8 1. chdimn8 z2. chdiyr8 z2. chlive8 $ 2. chmar8 1. cheduc8 z2. chcomp8 $ 1. chschl8 1. chshlv8 1. chcmb8 z4. org8 1. chsex9 $ 1. chrel9 z2. chmort9 1. chdimn9 z2. chdiyr9 z2. chlive9 $ 2. chmar9 1. cheduc9 z2. chcomp9 $ 1. chschl9 1. chshlv9 1. chcmb9 z4. org9 1. chsex10 $ 1. chrel10 z2. chmort10 1. chdimn10 z2. chdiyr10 z2. chlive10 $ 2. chmar10 1. cheduc10 z2. chcomp10 $ 1. chschl10 1. chshlv10 1. chcmb10 z4. org10 1. chsex11 $ 1. chrel11 z2. chmort11 1. chdimn11 z2. chdiyr11 z2. chlive11 $ 2. chmar11 1. cheduc11 z2. chcomp11 $ 1. chschl11 1. chshlv11 1. chcmb11 z4. org11 1. chsex12 $ 1. chrel12 z2. chmort12 1. chdimn12 z2. chdiyr12 z2. chlive12 $ 2. chmar12 1. cheduc12 z2. chcomp12 $ 1. chschl12 1. chshlv12 1. chcmb12 z4. org12 1. chsex13 $ 1. chrel13 z2. chmort13 1. chdimn13 z2. chdiyr13 z2. chlive13 $ 2. chmar13 1. cheduc13 z2. chcomp13 $ 1. chschl13 1. chshlv13 1. chcmb13 z4. org13 1. chsex14 $ 1. chrel14 z2. chmort14 1. chdimn14 z2. chdiyr14 z2. chlive14 $ 2. chmar14 1. cheduc14 z2. chcomp14 $ 1. chschl14 1. chshlv14 1. chcmb14 z4. org14 1. sknew 1. sksex $ 1. skrel z2. sklive $2. skmar 1. skeduc z2. skcomp 1. skschl z1. skshlv 1. skcmb z4. skorg 1. skord z2. ; run; proc freq; tables sknew; * tables chlive1 -- chlive2 sklive org1 -- org14; run; proc freq noprint; tables sknew*fgp*f75*f77*ckkd /out=t1; tables skorg * sknew /out=tab; run; proc print data = t1; proc print data = tab; run; data chk; set kidros; if sknew eq .; run; proc print; variables idswl ckkd v104t2 vdead2 K2 vcyr2 v96m2 v96s2 v102m2 v102s2; data top ; set chk (obs=20); run; proc print; vars ind org1 -- org6 chname1 -- chname6 n1201 -- n1206 sknew vskn ckkd vcnam1 -- vcnam6; run; endsas;