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
Related
I am analyzing a temporal trend(yr) of certain chemicals(a b & c).
I use proc sgplot and series statement to draw a plot and found there was a decreasing trend.
Becuase the data is right-skewed, I used the median concentration of each year to draw the plot.
Now I would like to conduct a statistical test on the trend. My data came from the NHANES and need to use the proc survey** to perform analysis. I know I can do an ANOVA test based on proc surveyreg and use ANOVA option in the MODELstatement.
proc suveyreg data=a;
stratum stra;
cluster clus;
weight wt;
model a=yr/anova;
run;
But since the original data is right-skewed, I think maybe it is better to use Kruskal-Wallis test on the original data. But I don't know how to write a code in SAS and I didn't find information in proc survey**-related document.
My plan B is to use the log-transformed data and ANOVA test. But I am not sure if that is an appropriate approach. Can somebody tell me how to get the normality test of the residual in ANOVA while using proc surveyreg? I would also like to know if I can test a b & c in one procedure or I should write multiple procedures with changes in MODEL statement.
Looking forward to your engagement.Thank you!
I'm trying to report estimates of proportions of subjects of a stratified random sample
I've tried every website I can find for SAS proc surveymeans, and I don't understand what I'm doing wrong.
data b;
set Data;
keep id texting section;
run;
proc surveyselect data=b out=samp_b method=srs n=(15,12,10,8)
seed=123;
strata section;
run;
proc surveymeans data=samp_b;
strata section;
weight SamplingWeight;
var texting;
run;
I should get confidence intervals for the strata, but they are not showing up. Also I need confidence intervals for the proportions!
I don't know what version of SAS/STAT you are using, but per SAS/STAT 9.2 Proc Surveymeans documentation pages, you can do one or both of the following:
1) Add the relevant statistics keywords to the proc surveymeans statement
https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_surveymeans_sect007.htm
In the PROC SURVEYMEANS statement, you also can use statistic-keywords to specify statistics for the procedure to compute. Available statistics include the population mean and population total, together with their variance estimates and confidence limits. You can also request data set summary information and sample design information.
The available statistics keywords are listed and described on these pages:
https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_surveymeans_a0000000238.htm
https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_surveymeans_sect007.htm#statug.surveymeans.smeanskeys
So, to print the 95% two-sided confidence interval for the mean, you would add CLM to the end of your Proc Surveymeans statement.
2) Save the Statistics table with confidence intervals to a separate SAS dataset with an additional ods output Statistics=MyStat; statement, per these instructions.
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
I want to put all confidence interval plot in one plot for all strata variable after logistic regression. For example, my SAS code is:
proc logistic data=data1;
model y = x;
strata cv1;
output out=out1 unknown1=x_beta1 unknown2=lowerbound unknown3=upperbound unknown4=strata_variable;
run;
I do not know what variable names(unknown1 unknown2 unknown3) I can use in the output statement. As in the sas support page, it said "If a STRATA statement is specified, only the PREDICTED=, DFBETAS=, and H= options are available",here is the link.
My plot statement will be:
proc sgplot data=out1;
scatter y=strata_variable x=x_beta1 / xerrorlower=lowerbound xerrorupper=upperbound
markerattrs=(symbol=circlefilled size=9);
run;
The first plot in this page shows exactly what I want. Sorry I cannot insert any plot as my reputation is not high enough.
I find an another way to finish this. I wrote a macro do loop to get every strata data. And then added
ods output OddsRatios=odds_temp;
to get the estimation and confidence interval and merger all the strata together to make the plot I need.
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;