BookmarkSubscribeRSS Feed
ldavidr
Calcite | Level 5

Good day! So I'm learning to use SAS and I've been all day trying to put percentages in the y axis, but the right one. My current graph already uses reflines but I want to replace the reflines for a percentage scale from 0 to 100% in 10 by 10. Is there a way to do it?

I'm on SAS 9.3

Sin título.png

 

 
2 REPLIES 2
Reeza
Super User
Probably. Post your code. Including sample data to allow us to replicate your graph would help, use the SASHELP datasets if necessary.
ChrisNZ
Tourmaline | Level 20

Like this?

      
proc summary data=SASHELP.PRDSAL2 ;
  where YEAR eq 1995;
  class MONYR;
  var ACTUAL PREDICT;
  output out=SUMMARY  sum=;
run;

data PLOT;
  if _N_=1 then set SUMMARY(where=(MONYR eq .) rename=(ACTUAL=TOTAL) );
  set SUMMARY(where=(MONYR ne .) );
  retain TOTAL;
  PCT+ACTUAL/TOTAL;
  format PCT percent10.1;
run;

proc sgplot data=PLOT; 
  vbar monyr / response=ACTUAL ;
  vline monyr / response=PCT y2axis;
run;

(modified from https://communities.sas.com/t5/SAS-GRAPH-and-ODS-Graphics/using-second-y2axis-with-proc-sgplot-vbar/...)

 

Capture.PNG

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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
  • 830 views
  • 2 likes
  • 3 in conversation