SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
kz_
Quartz | Level 8 kz_
Quartz | Level 8

I'm using proc sgplot and I would like a dark solid line over a fairly transparent scatter plot. Can I adjust the transparency for the line/markers individually? 

It seems you that you can't put 'transparency' inside either set of parentheses. 

 

 

 

proc sgplot data=mydata; 
	reg y=hrs x=days / lineattrs=(thickness=4 color=red)
		markerattrs=(symbol=circlefilled size=6) transparency=0.85; 
	yaxis grid values=(0 to 1800 by 100) label="ylabel";
	xaxis label="xlabel";
run;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

I might suggest two REG statements. One with the markers and transparency you want , the second with the line attributes you want and the NOMARKERS option.

 

The order of the REG statements will have some impact so I suspect the first should be the one with markers and the second the one without markers so the line draws over the previous line.

View solution in original post

2 REPLIES 2
ballardw
Super User

I might suggest two REG statements. One with the markers and transparency you want , the second with the line attributes you want and the NOMARKERS option.

 

The order of the REG statements will have some impact so I suspect the first should be the one with markers and the second the one without markers so the line draws over the previous line.

Ksharp
Super User

You could overlap scatter points or line to make it happen.

 

proc sgplot data=sashelp.heart; 
	scatter y=height x=weight/markerattrs=(symbol=circlefilled size=6) transparency=0.85;
    reg y=height x=weight / lineattrs=(thickness=4 color=red ) nomarkers; 
	yaxis grid  label="ylabel";
	xaxis label="xlabel";
run;

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 2823 views
  • 2 likes
  • 3 in conversation