/* Sas job to simulate data generated under a bivariate normal distribution of variables v(1) and v(2). If v(2) is less than zero, v(2) is missing /* * Preliminaries; OPTIONS nocenter; FILENAME sibs 'selonx.rec'; * Simulation data step; DATA NEALE1; FILE sibs; array v{2}; x=.5; n=0; sample: IF N gt 500 THEN GO TO DONE; n=n+1; famfac=rannor(0); v(1)=SQRT(X)*famfac + SQRT(1-X)*RANNOR(0); v(2) = SQRT(X)*famfac + SQRT(1-X)*RANNOR(0); if v(2) gt 0 then do; size=2; end; else do; v(2)=.; size=1; end; PUT v(1) v(2); OUTPUT; x1=v{1}; y=v{2}; GO TO sample; DONE: COMMENT sample complete; * Compute correlation and covariance matrices; DATA CONKERS; SET NEALE1; PROC CORR COV; VAR x1 y; * Compute covariance matrix for complete data records only (Y not missing); DATA CONKER2; SET NEALE1; if y ne .; PROC CORR COV; VAR x1 y; * Compute covariance matrix for incomplete records only (Y missing); Data Conker3; set neale1; if y eq .; PROC CORR COV; VAR x1 y; * Tell sas to go to it if it hasn't decided to by itself; RUN;