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

Sorry if this is the wrong location. It's confusing to figure out which one is the correct forum, but I want to rename the y-axis of the plot that is produced by

 

 

proc plot;

	plot energy_weekday * temp = 'W'
		energy_weekend * temp = 'S'
		/overlay;

 

 

to "energy" (right now, the plot shows "energy_weekday" as the y-axis).

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Put a label statement into the code

proc plot;
    plot energy_weekday * temp = 'W' energy_weekend * temp = 'S'/overlay;
    label energy_weekday='Energy';
run;
--
Paige Miller

View solution in original post

6 REPLIES 6
PaigeMiller
Diamond | Level 26

Put a label statement into the code

proc plot;
    plot energy_weekday * temp = 'W' energy_weekend * temp = 'S'/overlay;
    label energy_weekday='Energy';
run;
--
Paige Miller
FattahMArif
Calcite | Level 5
Thanks, it worked! It looks a bit awkward, so idk if there's a way to format it better, but it at least got the job done
ballardw
Super User

Haven't used Proc PLOT in over 30 years.

Is there a reason you don't want a nicer looking plot or is this intended for line-printer output?

FattahMArif
Calcite | Level 5

This is what my team has been doing since before I joined. What do you recommend instead?

ballardw
Super User

With any version of SAS since 9.1 I would be using Proc SGPLOT or SGPANEL for plots.

 

You should have the SASHELP.Class data set available to test the following code which produces two similar plots:

proc plot data=sashelp.class;
  plot weight*height
     /vpos=25
  ;
run;

proc sgplot data=sashelp.class;
  scatter x=height y=weight/markerattrs=(color=blue) transparency=.5;
run;

I used the transparency setting to make the colors in the SGPLOT output a bit transparent so when multiple values overlay that is shown by a more intense color fill instead of the letter B in the Plot result.

 

Sgplot adds multiple types of graphs, quite a bit more appearance options and will create pretty nice appearing output when sent to document formats like PDF and RTF.

 

FattahMArif
Calcite | Level 5

Sorry for the late reply, but I appreciate the info. Is it something that is covered in the courses? Thanks.

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
  • 6 replies
  • 735 views
  • 0 likes
  • 3 in conversation