Trying to remove confidence bands and prediction bands from SAS REG procedure - sas

My code
proc reg data=mydata plots=;
title "Correlation Between Estriol Levels and Birthweights";
model birthweight=estriol / clb cli clm;
run;
Plots the regression line and scatter plot but also includes the confidence bands and prediction bands. Is there a way I can hide one, the other, or both from the REG output?

I don't believe there's a way within PROC REG but you can accomplish something similar using PROC SGPLOT. See the documentation here for specifics such as modifying the colour/style or doing multiple lines.
Here's an example that uses the SASHELP.CLASS data set as an example.
proc sgplot data=sashelp.class;
reg x=age y=height;
run;
Documentation:
http://support.sas.com/documentation/cdl/en/grstatproc/69716/HTML/default/viewer.htm#p0mn6vl6clqbgyn1ivs69lezdxhf.htm

By using plots=; you are requesting the default set of plots in the output. You probably want to suppress the default set using plots(only)= and then specifying only the graphics you want.
See the PROC REG statement options at http://support.sas.com/documentation/cdl/en/statug/66859/HTML/default/viewer.htm#statug_reg_syntax01.htm

Related

SAS-sgplot-add label to bar clusters

I am looking for an option to add label to bar clusters.
I want the values: 0.940, 0.250, 0.520, 0.580, and 0.230 in the middle of the clustered bars, like the following:
Assuming you have SAS 9.4 TS1M2 or later, you have an option, seglabel, which specifically does this, other than the 'display only once', which I don't think is a thing you can get out of the box.
proc sgplot data=sashelp.cars;
vbar cylinders/group=origin groupdisplay=cluster seglabel;
run;
If you don't, or you need more control than that gives you (such as your request to display only once), there are options, such as in my paper, Labelling without the hassle; it is for stacked bar charts, but the general approach would work for clustered also, you'd just have to adjust things some.
This gets somewhat close, and probably would get nearly perfect for your case; it needs some customization for groups that don't have all three group values present, but you don't have that in your example.
More complex solutions exist using annotations or GTL, as well, with this general approach (of overlaying on the precomputed bars a label).
proc summary data=sashelp.cars;
class origin cylinders;
types origin*cylinders;
var mpg_city;
output out=cars_summary(drop=_:) n(mpg_city)=count;
run;
data cars_labels;
set cars_summary;
if origin='Asia' then count_asia=count;
if origin='USA' then count_usa=count;
if origin='Europe' then count_eu=count;
ypos = floor(count/2);
run;
proc sgplot data=cars_labels;
vbarparm category=cylinders response=count/group=origin groupdisplay=cluster;
scatter x=cylinders y=ypos/markerchar=count_asia discreteoffset=-0.35;
scatter x=cylinders y=ypos/markerchar=count_usa discreteoffset=0.20;
scatter x=cylinders y=ypos/markerchar=count_eu discreteoffset=-0.1;
run;

Rank-ordering output from proc logistic

In the SAS proc logistic output, is there a way to rank-order by decreasing value of Wald's Chi square statistic?
Here's a link to an example of using ODS to write procedure output to a SAS dataset. The example uses proc genmod, but the concept applies to proc logistic as well. The documentation for proc logistic contains all of the ODS table names produced by the proc. Find the one you are interested in, write it out to a data set, and sort it however you desire.

plot entire time series in SAS?

I am trying to make a forecast, and I want to see the entire time series, with the forcasted period at the end (need to compare with another graph of this kind).
SAS 9.4 does not want to comply, however, and only shows me the forecasting part.
What can I do to remedy this?
The code I'm using is:
Proc arima data=logtabell;
identify var=y(12) nlag=24;
estimate p=1 q=2;
forecast lead=12 interval=month id=date out=results;
run;
Your out= dataset will contain all values by default. If you want to specifically see the full graph that it outputs, add the plots option:
proc arima data=logtabell plots=forecast(forecast);
Or, just do it the easy way by getting every plot:
proc arima data=logtabell plots = all;
Also, make sure ods graphics on; is set.
SAS procedures have an out=resultSet option, from which you can get the results in a dataset.
Combine this output with your time serious in one graph created with proc sgplot

how to find outliers in sas with proc means?

is there a way to detect an outlier from proc means while calculating min max Q1 and Q3?
the box plot procedure is not working on my SAS and I am trying to perform a boxplt in excel with the values from SAS.
Assuming you have a specific definition for what an outlier is, PROC UNIVARIATE can calculate the value that appears at that percentile using the PCTLPTS keyword on the OUTPUT statement. It also will identify extreme observations individually, so you can see the top few observations (if you have few enough observations that the number of extremes is likely to be <= 5).
The paper A SAS Application to Identify and Evaluate Outliers goes over a few of the ways you can look at outliers, including box plots and PROC UNIVARIATE, and includes some regression-based approaches as well.
If you want a 'standard boxplot' use the outbox= option in SAS to create the standard data set used for a box plot.
proc boxplot data=sashelp.class;
plot age*sex / outbox = xyz;
run;

Storing the PCT from proc gchart in a table

I am using proc chart on a discrete variable.
I am curious how to store just the percentage value (pct) from the output into a table ?
I tried the gout option (gout=test1) below but it stores the whole graph as an image,
I dont want that. I just want the pct values.
proc gchart data= Native5 gout=test1;
hbar RBMI/discrete;
run;
Well, since the GOUT option was intended to output graphics, it would be a surprise if it did anything else. Just for the sake of interest, what version of SAS are you using? In 9.2 the GOUT option appears to be deprecated. Also, PROC GCHART is subsumed into PROC SGPANEL.
Is there a particular reason you want the relative frequencies from GCHART as opposed to TABULATE or FREQ?