I am drawing a normal histogram using the proc univariate procedure in sas:
proc univariate data=test;
histogram variabel;
run;
My question is simple. How do I make SAS write the text on the 1. axis in a vertical and not horizontal way?
I haven't been able to find a proper answer on the forum.
Thanks in advance.
If you are not using ODS Graphics, then this is fairly easy:
ods graphics off;
axis1 value=(angle=90);
proc univariate data=sashelp.class;
histogram age/haxis=axis1;
run;
This uses the axis options. These only apply to old-style graphics.
In ODS graphics, this is not really possible in a simple fashion. Fully, mandatory rotated axis labels are not possible until 9.4, and even then it is in GTL. You can use annotation to create your own axis labels, though, which is probably your best bet. Either way you wouldn't do it in PROC UNIVARIATE but in a PROC SGPLOT histogram.
Related
How to take first derivative of cubic spline on sas
I am stuck at the below:
proc Transreg data=A;
model identity(y)=spline (x/ nknots=4);
Run;
Use ODS OUTPUT SPLINECOEF=<dataset> to capture the spline coefficients.
I am trying to create a scatter plot in SAS. I used the following code below;
proc sgplot data = data1;
series y = data_points x = Date;
run;
However the code creates a scatter plot where the data_points are linked together by a line.
I do not want the data_points to be linked together at all.
How do I solve this problem please?
SERIES -> draws a line plot
SCATTER -> draws a scatter plot
Change SERIES to SCATTER, that's the only change you need.
I am fitting a mixture model consisting of 3 Poisson distributions. For my report I would like to obtain the histogram of the response together with the fitted distribution. Normally, it is as simple as using plots=density option in the proc fmm statement, so my code is as follows:
ods graphics on;
proc fmm data=hw1 plots=density(bins=30);
model frequency= / dist=poisson k=3 parms(2.21,2.59,3.13);
probmodel / parms(-0.69,0.11);
freq count;
run;
ods graphics off;
My problem is that the code produces only the histogram without the density. I was wondering if anybody knows if it could be related to the Poisson distribution and proc fmm does not support it? Because when I change the dist=poisson to dist=gaussian it works.
Thank you
This is because the Poisson distribution is a discrete and not a continuous distribution. If you need a continuous distribution, try something like the normal or weibull distributions.
I'm trying to use proc gplot to create a plot of my y-variable against response, but have a specific covariate(z) on the x-axis. Is there a way to do this in gplot? Ive tried yxz, yx yz, and a bunch of other similar things but can't figure it out.
Thanks!
It sounds like a basic plot to me, I prefer PROC SGPLOT because its the easiest/clearest way to specify the X/Y. Assuming it's a scatter use SCATTER, if you want a line, use SERIES.
proc sgplot data=MY_DATA;
SCATTER X=TIME Y=PREDICTED_VAR;
RUN;
I am trying to create a single ROC curve for three bio-markers on a common population.
I have already created an overlay curve from proc logistic statement. is there any way in SAS (among default options) to label the specific points on one of the bio-markers.
also, I would like to create a horizontal and vertical lines that depict the Sn and 1-Sp for those specific points.
is there an easier way to do this other than creating a annotation dataset and plotting a graph through proc gplot?
Thanks in advance!!
Among default options, the answer is no. SAS gives you options to control certain aspects of the ROC curves in the roc and rocoptions options in the proc logistic statement, but it doesn't support adding specific features to plots directly within the procedure.
To get the features you're looking for, as you said, you'll need to plot the raw ROC data using a graphics procedure. I like sgplot, the ODS graphics successor to gplot. Assuming you know exactly which points you want to label ahead of time, horizontal and vertical lines for the sensitivity and 1 - specificity can be generated using the refline statement in sgplot.
An annotation dataset may be the best way to go to label specific points. If you're using sgplot, you can generate an SG annotation dataset using the SG annotation macros. More information regarding SG annotation, including the use of the macros, can be found here. The macros are located in the default SAS autocall macro library so they should be able to be referenced without any special fussing. Once you have your dataset, you can feed it into sgplot using the sganno= option in the proc sgplot statement.