Hi all-
If I run a model (i'm using Proc Logistic), and I then want to use that same equation, is there an easy way to do it?
I am trying to validate my model on a subsample of my data.
Right now, I'm taking the parameters output data set, transposing it, then using PUT statements to write it to a file, which i then read back in as a single variable that I save to a macro variable. Then I use that macro variable in a data set. It's a bit of an ordeal, and the use of an external file made me think there must be a better way of doing this.
Your input is appreciated!
Here's the code equivalent from what I did:
options lrecl = 1000 ;
data _null_;
set transparm (where = (_NAME_ ne '_LNLIKE_')) end = eof ;
file "LogRegFunc.txt" ;
if lowcase(_NAME_) eq 'intercept' then
do ;
put coeff "+ " @@ ;
end ;
else
do ;
if not(eof) then
do ;
put "(" coeff "* " _NAME_ +(-1) ") + " @@ ;
end ;
else if (eof) then
do ;
put "(" coeff "* " _NAME_ +(-1) ")" ;
end ;
end ;
run ;
data _null_ ;
infile "LogRegFunc.txt" ;
length equation $1000. ;
input ;
equation = _infile_ ;
call symputx('LogRegEq', equation) ;
run ;
data predicted;
set model_out ;
if validation then
do ;
v_log_est = &LogRegEq ;
v_upg_rate = exp(v_log_est)/(1-exp(v_log_est)) ;
end ;
if rel_mth eq 45 then v_upg_rate = v_upg_rate ;
run ;
The term is SCORING a dataset.
See the example under proc logistic:
Example 53.15
The term is SCORING a dataset.
See the example under proc logistic:
Example 53.15
Thanks Reeza!
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.