i am able to output all sorts of statistics and values, however, am missing the ability to output p-values of parameter estimator significance.
I do get them in the Output window but not in my outputted tables. Here is my code
ods output PhilOul = philipps FitSummary = Stats;
proc autoreg data=ppnr_1.train outest=regression_13;
model mnos = ir_irs10y_yoyd ur_ap_yoy sav_yoyd_l1
/ stationarity=(PHILLIPS)
;
where date ge "&dev_start." and date le "&dev_end." ;
proc print data = regression_13;
run;
quit;
As you can see, I get DW-statistics (in "Stats" table), PhilipsOulier ("Philipps" table) and parameter estimates ("Regression_13") but not the significance of these parameters...
Best regards, Niels
EDIT: I used to figure out how to output p-values in PROC REG statement. Specify the TABLEOUT option. However, this option is not valid in PROC AUTOREG :-(
The p-values are in ODS output table ParameterEstimates. Change your code to be:
ods output
PhilOul = philipps
FitSummary = Stats
ParameterEstimates = Estimates
;
You can observe the ODS output tables that a procedure creates by using ODS TRACE. You only need to trace once, or if you forget :).
ODS TRACE ON;
PROC ...;
ODS TRACE OFF;
Related
I'm trying to export quartile information on a grouped dataset as a dataset in SAS but when I run this code my output is a table with the correct information displayed but the dataset WORK.TOP_1O_PERC is only summary statistics of the set (no quartiles). Does anyone know how I can export this as the CLASS (PDX) and its 25th and 75th percentiles? Thanks!
PROC MEANS DATA=WORK.TOP_10_DX P25 P75;
CLASS PDX;
VAR AmtPaid;
OUTPUT OUT = WORK.TOP_10_PERC;
RUN;
I like the STACKODS output that is a data set which is like the default printed output.
proc means data=sashelp.class n p25 p75 stackods;
ods output summary=summary;
run;
proc print;
run;
You can use output statement with <statistics>= options.
PROC MEANS DATA=WORK.TOP_10_DX NOPRINT;
CLASS PDX;
VAR AmtPaid;
OUTPUT OUT = WORK.TOP_10_PERC P25=P25 P75=P75;
RUN;
Compared to ods output, output statement is much faster but less flexible with multiple analysis variables or by statement specified situation.
I have the following code to produce descriptive statistics:
proc means data=sashelp.cars;
var Horsepower Weight Length;
output out = cars_stats mean = std = /autoname;
run;
I would like to get the table shown in the Results tab in the Output Data as I export the tables to Excel later on.
At the moment I get the following in the results:
But I get this in the Output Data tab.
How could I get the table from the Results in the Output Data?
Proc MEANS with option STACKODSOUTPUT will produce the same desired table.
ods select none;
proc means data=sashelp.cars stackodsoutput;
var Horsepower Weight Length;
ods output summary = cars_stats_stacked;
run;
ods select all;
ods to the rescue!
First run your code like this:
ods trace on;
proc means data=sashelp.class;
var Weight Height;
output out = class_stats mean = std = /autoname;
run;
ods trace off;
Then check the log:
Output Added:
-------------
Name: Summary <-- We want this bit
Label: Summary statistics
Template: base.summary
Path: Means.Summary
-------------
Then re-run like this:
ods select none;
ods output summary = class_summary;
proc means data=sashelp.class;
var Weight Height;
output out = class_stats mean = std = /autoname;
run;
ods select all;
This approach allows you to capture any output from any proc that would normally be displayed in the results area as a sas dataset instead.
I´ve been using the UNIVARIATE proccedure in order to get the p-value from a series of distributions (lognormal, exponential, gamma) and have reached the following problem:
I am using the following code to get the p-values of the goodness of fit tests for each of the distributions:
ods select all/*ParameterEstimates GoodnessOfFit*/;
proc univariate data=results.Parametros_Prueba_1;
var Monto_1.;
histogram /
lognormal (l=1 color=red SHAPE=&ParamLOGN2_1 SCALE=&ParamLOGN1_1)
gamma (l=1 color=red SHAPE=&ParamGAM1_1 SCALE=&ParamGAM2_1)
exponential (l=2 SCALE=&ParamEXP1_1);
ods output GoodnessOfFit=results.Goodness_1;
run;
proc print data=results.Goodness_1;
After running the previous code I get the "Results" which gives me the histogram graphic and other descriptive information about the tests. I am looking for a way to get this "Results" print to show only the last part corresponding to the "proc print" added on the last line.
Thanks in advance!
If you want no output to the screen (results window) from PROC UNIVARIATE, then the simplest answer is:
ods select none;
proc univariate ... ;
run;
ods select all;
proc print ... ;
run;
ods select none; tells ODS to not make any ODS output whatsoever. You'll still get your ODS OUTPUT though as that comes in afterwards.
ods select none;
proc univariate data=sashelp.class;
var height;
histogram name='univhist' /
lognormal (l=1 color=red )
gamma (l=1 color=red )
exponential (l=2 );
ods output GoodnessOfFit=Goodness_1;
run;
ods select all;
proc print data=Goodness_1;
run;
Now, you'll note you don't get your histogram; that one is harder. It unfortunately changes its name every time you run it, and even if you use the NAME= option, that'll only work the first time it's run. You need to use PROC GREPLAY to delete it.
proc greplay nofs igout=work.gseg;
delete 'univhist';
run; quit;
(Assuming UNIVHIST is the name you assign it.)
I am trying to carry out a logistic regression with SAS. I have few settings for the model, and try to compare the difference.
What I want to archieve is to output the estimated coefficients to a file. I think ODS maybe a promising way, but don't know how to use it.
Can anyone write me a simple example?
Thank you very much.
To add a bit of additional color; ODS OUTPUT <NAME>=DATASET ... ; will save the output into the specified dataset.
Use ODS TRACE get the names of output tables. Information on the tables will be written to the log.
ods trace on;
ods output ParameterEstimates=estimates;
proc logistic data=test;
model y = i;
run;
ods trace off;
For Logistic:
proc logistic data = in descending outest = out;
class rank / param=ref ;
model admit = gre gpa rank;
run;
For proc reg:
proc reg data=a;
model y z=x1 x2;
output out=b
run;
for proc glm:
ods output Solution=parameters FitStatistics=fit;
proc glm data=hers;
model glucose = exercise ;
quit;
run;
for proc reg this doesn't work for me
Use proc reg OUTEST=b
proc reg data=a outest=b;
model y=x1;
run;
other reg can get other parameters added to OUTEST.
I've been trying to figure out a way to output DFBETAS produced in PROC REG to a SAS data object. I know that residuals, internal and external studentized residuals, and leverage can be outputted by using the output option, for example:
proc reg data=dataset;
model y = x1 + x2;
output out=influence_stats r=r student=int_r rstudent=ext_r h=leverage;
run;
but it doesn't seem that PROC REG provides an option to output DFBETAS. Thank you!!
http://www.ats.ucla.edu/stat/sas/webbooks/reg/chapter2/sasreg2.htm
ODS OUPTUT is your answer (for basically anything like this - if it's not coming out on the output dataset, ODS OUTPUT can get almost anything that goes to the output window). The example in the book isn't very good style - I would not put the ODS OUTPUT statement in the middle of the proc - but it ought to work. (You probably need an ODS OUTPUT CLOSE; statement later on.) How I'd do it:
ods output outputstatistics=outstats;
proc reg data=dataset;
model y = x1 + x2;
output out=influence_stats r=r student=int_r rstudent=ext_r h=leverage;
run;
ods output close;
More on ODS OUTPUT: http://www2.sas.com/proceedings/forum2008/086-2008.pdf - in particular read the part where they show you how to use ODS TRACE to figure out which table to use.