Reputation: 728
My values in the dataset are in Billions and when I am plotting the data the Y-Axis is showing the interval in 2.0E7, 2.0E8 etc instead of the actual value. I want to put the scale in legend as "in Millions" rather than showing it in the exponential scale. How to do that?
proc sgplot data=t_analytics ;
series x=year y=CC / markers datalabel;
series x=year y=DC / markers datalabel y2axis;
series x=year y=NC / markers datalabel y2axis;
yaxis interval=auto grid logbase=10 ;
xaxis display=(nolabel) ;
run;
CC, DC, NC values are in millions.
Thanks in advance
Upvotes: 1
Views: 3108
Reputation: 63424
You could put this in a format, also. Picture formats are very good at multiplying.
data test;
do year=1995 to 2015;
cc = (year-1994)*1000000;
output;
end;
run;
proc format;
picture millionsF
0-high = '00' (mult=0.000001);
quit;
proc sgplot data=test;
series x=year y=CC / markers datalabel;
format CC millionsf.;
xaxis display=(nolabel) ;
yaxis interval=auto grid logbase=10 label='In Millions';
run;
Of course, you could put the in millions
in the picture format if you prefer, or just in the axis label.
Upvotes: 1
Reputation: 12465
Divided by 1e6 before plotting and adjust the axis label
data to_plot;
set t_analytics;
CC = CC/1e6;
DC = DC/1e6;
NC = NC/1e6;
run;
proc sgplot data=to_plot;
series x=year y=CC / markers datalabel;
series x=year y=DC / markers datalabel y2axis;
series x=year y=NC / markers datalabel y2axis;
yaxis interval=auto grid logbase=10 label="in Millions" logstyle=logexpand;
xaxis display=(nolabel) ;
run;
EDIT: added logstyle=logexpand
to ensure values are printed and not the exponent. Should be default.
Upvotes: 2