*! version SWS3/stb-2:gr3/stb-12:gr3.1 gr3 utility * see comments at end-of-file program define _3dmkdta version 2.1 keep %_1 %_2 %_3 %_4 drop if %_1==. | %_2==. | %_3==. rename %_1 _x rename %_2 _y rename %_3 _z label var _x %_1 label var _y %_2 label var _z %_3 _3dmnmx _x X _3dmnmx _y Y _3dmnmx _z Z _3dax`%D3axis %XZERO %YZERO %ZZERO /* add axis */ mac drop XZERO YZERO ZZERO /* add names to data */ mac def _nobs1 = _N + 1 mac def _nobs2 = _N + 2 mac def _nobs3 = _N + 3 set obs %_nobs3 gen str8 _name = "" replace _name = "%_1" in %_nobs1 replace _name = "%_2" in %_nobs2 replace _name = "%_3" in %_nobs3 replace _Type = 4 in %_nobs1/l replace _x = cond(_n==%_nobs1,.5,-.1) in %_nobs1/l replace _y = cond(_n==%_nobs1,1.1,cond(_n==%_nobs2,.5,0)) in %_nobs1/l replace _z = cond(_n==%_nobs3,.5,0) in %_nobs1/l end exit /* _3dmkdta xvar yvar zvar [supvar] Utility routine to create varialbes named _x _y _z corresponding to xvar, yvar, zvar. The variables are rescaled so that the minimum is zero and the maximum is 1. axis are then added to the data set. labels are added to the data set: input byte _Type str8 _name _x _y _z 1 4 "" .5 1.1 0 2 4 "" -.1 .5 0 3 4 "" -.1 0 .5 end Anything specified in [supvar] is also kept. Caller should make arrangements to capture the break key. */