I am running a proc logistic with selection =score , to get the best model based on chi-square value. Here is the code
options symbolgen;
%let input_var=ABC_DEF_CkkkkkedHojjjjjerRen101 dept_gert home_value
child_household ;
ods output bestsubsets=score;
proc logistic data=trail;
model response(event='Y')=&input_var
/ selection=score best=1;
run;
The output dataset named score has been generated through ods output. Below is the image of the data set.
score data set image
In the score dataset, in the "variables included in model" column, you can only see a part of variable name "ABC_DEF_CkkkkkedHojjjjjerRen101" and not the entire name. May I know why is this happening and how do I get the entire variable name. Please let me know
Add NAMELEN=32 to your proc logistic statement.
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 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;
I have run a regression on a data set. I would like to then add the predicted values into the original data set table. I would like the PredictedMS_Diff values to be added to the PROPreg_CSR_final dataset.
proc reg data=PROPreg_CSR_final outest=outest_model_1 covout plots=diagnostics(stats=(default aic
sbc));
title "CSR Final";
FinalCSR:MODEL MS_Diff_CSR=Rank_Delta_prop;
Output PREDICTED=PredictedMS_Diff
run;
title;
Your output statement does not have an OUT= option so the data set is named by SAS. Also missing a semicolon.
Output PREDICTED=PredictedMS_Diff
If that has worked it would have been a copy of the input data with PredictedMS_Diff added.
proc reg data=sashelp.class;
model weight=height;
output out=pred predicted=p residual=r;
run;
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.