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!
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.