BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Robert_Kozarski
Calcite | Level 5

Dear SAS users,

 

How to make the grey-filled dots to be white-filled or 100% transparent (correspond to the Z missing):

 

the_plot.PNG

 

 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

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

Override them ? by plotting these two points separately twice ?

View solution in original post

6 REPLIES 6
Reeza
Super User
Use a data attribute map. Not sure how that works with PROC TEMPLATE but it works well with SGPLOT.
Robert_Kozarski
Calcite | Level 5

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

Rick_SAS
SAS Super FREQ

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; 

Robert_Kozarski
Calcite | Level 5

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

 

 

Ksharp
Super User

Override them ? by plotting these two points separately twice ?

Robert_Kozarski
Calcite | Level 5

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:

Capture.PNG