/*****************************************************************/ /* 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=140; %let version=140; %let maxwave=n; *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; 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 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); run;