Here's the minimal working example and the corresponding outcomes.
data _01;
call streaminit(1);
do I=1 to 5000;
X=rand("normal");
output;
end;
run;
axis1 value=(rotate=90);
symbol i=join;
proc gplot data=_01;
plot X*I/vaxis=axis1;
run;
proc univariate data=_01;
var X;
histogram/normal vaxis=axis1;
run;
quit;
Thanks.
AFAIK you don't change the options in graphs from PROC via AXIS type statements, you can change them by changing the template.
@Junyong wrote:
This is Junyong. Thanks for your reply. As aforementioned, I want the vertical values—not the vertical label—to be rotated. AXIS1 does work in PROC GPLOT (the left figure), but doesn't in PROC UNIVARIATE (the right figure). I wonder whether I can apply the same effect in PROC UNIVARIATE. I appreciate for the difference between ROTATE and ANGLE—I just found it.
I'm assuming this is what you're looking for, which is actually the ANGLE option. If you use ROTATE each letter rotates and it's kind of weird. You may need to reset the GOPTIONS as well.
goptions reset=all; axis1 label=(a=90 'this is a long label for the y-axis'); proc gplot data=sashelp.class; plot height*weight / vaxis=axis1; run;
Otherwise you'll need to explain in more detail what you want.
@Junyong wrote:
Here's the minimal working example and the corresponding outcomes.
data _01; call streaminit(1); do I=1 to 5000; X=rand("normal"); output; end; run; axis1 value=(rotate=90); symbol i=join; proc gplot data=_01; plot X*I/vaxis=axis1; run; proc univariate data=_01; var X; histogram/normal vaxis=axis1; run; quit;
Thanks.
This is Junyong. Thanks for your reply. As aforementioned, I want the vertical values—not the vertical label—to be rotated. AXIS1 does work in PROC GPLOT (the left figure), but doesn't in PROC UNIVARIATE (the right figure). I wonder whether I can apply the same effect in PROC UNIVARIATE. I appreciate for the difference between ROTATE and ANGLE—I just found it.
AFAIK you don't change the options in graphs from PROC via AXIS type statements, you can change them by changing the template.
@Junyong wrote:
This is Junyong. Thanks for your reply. As aforementioned, I want the vertical values—not the vertical label—to be rotated. AXIS1 does work in PROC GPLOT (the left figure), but doesn't in PROC UNIVARIATE (the right figure). I wonder whether I can apply the same effect in PROC UNIVARIATE. I appreciate for the difference between ROTATE and ANGLE—I just found it.
Neither the template-based ODS GRAPHICS nor the device-based output from UNIVARIATE supports rotated Y axis values. I tried turning off ODS GRAPHICS, and UNIVARIATE gave me a warning that it would not honor the rotate on the AXIS1 statement. To see this, just wrap the code this way:
ods graphics off;
proc univariate ... ;
ods graphics on;
You don't actual say what you are trying to accomplish. If the idea is to get a histogram and density curve then perhaps you can use Proc Sgplot.
proc sgplot data=_01; histogram x /nbins=40 showbins; density x; xaxis fitpolicy=rotate valuesrotate= vertical; run;
Proc SGPLOT allows overlaying a number of different plots in a single chart. In the above I used NBINS option to create more bins than the default algorithm would show. The Xaxis statement controls appearance of the axis. FITPOLICY says to rotate values instead of reducing the number tick marks, the VALUESROTATE controls whether you get vertical or angled result. If you want to force a more similar appearance on the tick mark values you could add VALUESFORMAT=f5.2 so each value forces 2 decimal places.
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.
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.
Ready to level-up your skills? Choose your own adventure.