*include goptions; goptions hsize=7in vsize=7in; *include data(marriage); %include marriage; proc mds data=marriage level = ordinal shape = triangle model = indscal dim = 3 pfinal nophist converge=.0001 out = config; id group; matrix years; var hawaiian parthawi caucasan puerto filipino chinese japanese korean ; run; proc Format; Value $POS 'Hawaiian','Puerto Rican' = '3' 'Japanese','Korean' = '1' 'Chinese' = '7' other = '2'; Value $SHAPE 'Hawaiian','Part Hawaiian' = 'BALL' 'Caucasian','Puerto Rican' = 'FLAG' other = 'SQUARE'; Data Config; /* Add group labels to dataset */ Drop _DIMENS_; Length SHAPEVAR $8; Set Config; where(_TYPE_='CONFIG'); Shapevar=put(GROUP, $SHAPE.); proc Print; Title2 'Output configuration'; proc PLOT data=CONFIG; Plot Dim2 * Dim1 $ GROUP; Title2 'Dimensions 1 & 2: 1928-1934'; proc PLOT data=CONFIG; Plot Dim3 * Dim1 $ GROUP; Title2 'Dimensions 1 & 3: 1948-1953'; Data LABELS; /* Annotate dataset for proc G3D */ Drop Dim1-Dim3 GROUP; Length XSYS YSYS ZSYS POSITION $1 ; Set Config; If _TYPE_='CONFIG'; X = Dim1; Y = Dim2; Z = Dim3; XSYS='2'; YSYS='2'; ZSYS='2'; POSITION = put(GROUP, $POS.); SIZE = 1.25; Function = 'LABEL '; TEXT=GROUP; Data CROSS; Drop Dim1-Dim3 GROUP X0 Y0; Length XSYS YSYS ZSYS POSITION $1 ; Set Config; XSYS='2'; YSYS='2'; ZSYS='2'; COLOR='GREEN'; X = Dim1; Y = Dim2; Z = -1.7; FUNCTION='MOVE'; output; X0 = X; Y0 = Y; X = X0 - .1; FUNCTION='MOVE'; output; X = X0 + .1; FUNCTION='DRAW'; output; X = X0; Y = Y0 - .1; FUNCTION='MOVE'; output; Y = Y0 + .1; FUNCTION='DRAW'; output; Data LABELS; /* Concatenate the 2 annotate data sets */ Set LABELS CROSS; run; Data XTRA; /* Add dummy points to extend X, Y range */ Input DIM1-DIM3 SHAPEVAR $; datalines; -2.0 1.5 -1.7 POINT 1.5 -2. -1.7 POINT Data Config; Set Config Xtra; proc G3D DATA=Config; Scatter Dim2 * Dim1 = Dim3 /shape=Shapevar size=.7 ZMAX=1.7 ZMIN=-1.7 XTICKNUM=2 YTICKNUM=2 ZTICKNUM=2 GRID ANNOTATE=LABELS; Title H=1.5 '3D MDS Solution for Hawaiian InterMarriage Rates'; Title2 H=1.5 F=COMPLEX 'Data from Parkman & Sawyer (1967)'; run; %gfinish;