/************************************************************************/ /* Created by Paul Agius 2/11/2006 (Updated by: Michelle Summerfield) */ /* Purpose of the program: */ /* SAS program to create unbalanced and balanced wide files */ /************************************************************************/ * Specify the release and the version of the data used; %let release=190; %let version=190; %let maxwave=s; *Location of datasets (edit to reflect your paths); libname hilda "X:\HILDA\Release &release.\files\SAS &version.c" access=readonly; /*Sorting files by xwaveid for merging*/ proc sort data = hilda.combined_a&version.c out=w1; by xwaveid; proc sort data = hilda.combined_b&version.c out=w2; by xwaveid; proc sort data = hilda.combined_c&version.c out=w3; by xwaveid; proc sort data = hilda.combined_d&version.c out=w4; by xwaveid; proc sort data = hilda.combined_e&version.c out=w5; by xwaveid; proc sort data = hilda.combined_f&version.c out=w6; by xwaveid; proc sort data = hilda.combined_g&version.c out=w7; by xwaveid; proc sort data = hilda.combined_h&version.c out=w8; by xwaveid; proc sort data = hilda.combined_i&version.c out=w9; by xwaveid; proc sort data = hilda.combined_j&version.c out=w10; by xwaveid; proc sort data = hilda.combined_k&version.c out=w11; by xwaveid; proc sort data = hilda.combined_l&version.c out=w12; by xwaveid; proc sort data = hilda.combined_m&version.c out=w13; by xwaveid; proc sort data = hilda.combined_n&version.c out=w14; by xwaveid; proc sort data = hilda.combined_o&version.c out=w15; by xwaveid; proc sort data = hilda.combined_p&version.c out=w16; by xwaveid; proc sort data = hilda.combined_q&version.c out=w17; by xwaveid; proc sort data = hilda.combined_r&version.c out=w18; by xwaveid; proc sort data = hilda.combined_s&version.c out=w19; by xwaveid; run; proc sort data = hilda.master_&maxwave.&version.c out=master; by xwaveid; run; /*Creating unbalanced data file*/ data wide_UNBALANCED; merge w1 w2 w3 w4 w5 w6 w7 w8 w9 w10 w11 w12 w13 w14 w15 w16 w17 w18 w19 master; by xwaveid; run; /*Creating balanced data file for interviewed persons*/ data wide_BALANCED; set wide_UNBALANCED; if (afstatus = 1 or afstatus = 2) and (bfstatus = 1 or bfstatus = 2) and (cfstatus = 1 or cfstatus = 2) and (dfstatus = 1 or dfstatus = 2) and (efstatus = 1 or efstatus = 2) and (ffstatus = 1 or ffstatus = 2) and (gfstatus = 1 or gfstatus = 2) and (hfstatus = 1 or hfstatus = 2) and (ifstatus = 1 or ifstatus = 2) and (jfstatus = 1 or jfstatus = 2) and (kfstatus = 1 or kfstatus = 2) and (lfstatus = 1 or lfstatus = 2) and (mfstatus = 1 or mfstatus = 2) and (nfstatus = 1 or nfstatus = 2) and (ofstatus = 1 or ofstatus = 2) and (pfstatus = 1 or pfstatus = 2) and (qfstatus = 1 or qfstatus = 2) and (rfstatus = 1 or rfstatus = 2) and (sfstatus = 1 or sfstatus = 2); run;