BookmarkSubscribeRSS Feed
rebelde52
Fluorite | Level 6

Hello, 

 

I created this time series graph with concentration on my left Y axis and Cases on my Right Y axis. 

I used "SCATTER" for my concentration and 'LOESS" for my cases. 

So I have 2 questions.

 

1) How can I get change my legend from saying "LOESS" to "Cases"?

 

2) Any suggestions on how to make this look cleaner and nicer to look at?

Below is my code and my current graph. Thank you. 

 

proc sgplot data=WWCC;
 SCATTER x=date y=concentration;
 LOESS  x=date y=cases / Y2AXIS lineattrs=(pattern=Solid color=Red);
Run;

Screenshot 2023-04-12 at 11.03.10 PM.png

2 REPLIES 2
BrunoMueller
SAS Super FREQ
Add the option legendlabel="Cases" to your LOESS statement, to get the proper legend.
Ksharp
Super User
data wwcc;
 set sashelp.stocks;
 if stock='IBM';
 label open='concentration' close='Cases';
run;

proc sgplot data=WWCC;
 SCATTER x=date y=open;
 LOESS  x=date y=close / Y2AXIS lineattrs=(pattern=Solid color=Red)  legendlabel='Cases';
 yaxis type=log;
 y2axis type=log;
Run;

Ksharp_0-1681386200008.png

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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