Dear SAS users,
How to make the grey-filled dots to be white-filled or 100% transparent (correspond to the Z missing):
here comes the code:
data data_xyz;
input X Y Z;
datalines;
1 5 10
2 6 20
3 7 .
4 8 40
5 9 .
6 10 60
;
run;
proc template;
define statgraph scatter3Dcol;
dynamic valueX valueY valueZ;
begingraph;
layout overlay / xaxisopts=(label='X' linearopts=(viewmin=0 viewmax=10))
yaxisopts=(label='Y' linearopts=(viewmin=0 viewmax=10));
scatterplot x=valueX y=valueY / markercolorgradient=valueZ colormodel=(CX3288BD CX99D594 CXE6F598 CXFEE08B CXFC8D59 CXD53E4F)
markerattrs=(symbol=circlefilled size=13 transparency=0.3) FILLEDOUTLINEDMARKERS=TRUE name="Scatter";
continuouslegend "Scatter" / title='Observed X levels';
endlayout;
endgraph;
end;
run;
proc sgrender data=data_xyz template=scatter3Dcol;
dynamic valueX="X" valueY="Y" valueZ ='Z';
run;
Thanks,
Robert
Override them ? by plotting these two points separately twice ?
Hi Reeza,
Thank you for your prompt response. For some reason I need to have it done under the proc template framework. I will try with attribute map.
Best,
Robert
Do you want the entire marker to be missing/transparent? If so, use a WHERE clause on the DATA= option:
proc sgrender data=data_xyz(where=(Z NE .)) template=scatter3Dcol;
Thanks Rick,
I need the frames for my non-associated points. Ive just posted a solution with overwritten non-missing and missing Z observations.
Robert
Override them ? by plotting these two points separately twice ?
Thanks for your responses. Ive overwritten the scatterplots with non-missing and missing Z. Below is the code, even though a bit rough and ready.. If you think I could make it more neat pls do let me know.
Robert
data data_xyz;
input X Y Z;
datalines;
1 5 10
2 6 20
3 7 .
4 8 40
5 9 .
6 10 60
;
run;
data data_xyz1;
set data_xyz;
where Z ne .;
rename X=X1 Y=Y1 Z=Z1;
run;
data data_xyz2;
set data_xyz;
where Z eq .;
rename X=X2 Y=Y2;
run;
data data_xyz3;
merge data_xyz1 data_xyz2;
run;
proc print data= data_xyz3;run;
proc template;
define statgraph scatter3Dcol_1;
dynamic valueX1 valueY1 valueZ1 valueX2 valueY2 valueZ2 _trans _size;
begingraph;
layout overlay / xaxisopts=(label='X' linearopts=(viewmin=0 viewmax=10))
yaxisopts=(label='Y' linearopts=(viewmin=0 viewmax=10));
scatterplot x=valueX1 y=valueY1 / markercolorgradient=valueZ1 colormodel=(CX3288BD CX99D594 CXE6F598 CXFEE08B CXFC8D59 CXD53E4F)
markerattrs=(symbol=circlefilled size=_size) datatransparency=_trans FILLEDOUTLINEDMARKERS=TRUE name="Scatter";
scatterplot x=valueX2 y=valueY2 /
markerattrs=(symbol=circle color=black size=_size) datatransparency=_trans FILLEDOUTLINEDMARKERS=TRUE name="Scatter1";
continuouslegend "Scatter" / title='Observed Z levels';
endlayout;
endgraph;
end;
run;
proc sgrender data=data_xyz3 template=scatter3Dcol_1;
dynamic valueX1="X1" valueY1="Y1" valueZ1 ='Z1' valueX2="X2" valueY2="Y2" _trans=0 _size=13;
run;
resulting with:
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.