Hello everyone,
Here I have a question about how to perform mathematic computation across datasets.
Say I have a dataset coefficient like this:
variable coef
age 15
gender 3
hight 6
and another dataset student which have variables age, gender, hight, and others (all numerical):
ID age gender hight grade weight
1015 5 0 146 10 37
.........
I want to compute a score of each row in dataset "student " by using the value of variables in student time the corresponding coef in data coefficient and then sum up, i.e. : age*15+gender*3+hight*6.
Can someone help me realize this?
Thank you very much!!!
Best wishes.
Where do the coefficients come from?
Can you use PROC SCORE to implement this somehow?
Hi Reeza,
Yes, it is the coefficents from SAS output.
I tried proc score as you suggestted, but i have categorical variable, say rank, which has 5 levels, when i score it, the coefficents become rank1 rank2 rank3 rank4 rank5...
How to resolve this problem?
Thank you very much!!!
PROC SCORE will handle the categorical variables as long as the data used for scoring is identical, in format, to the input data.
Dear Reeza,
This is the code I'm using,
proc logistic data=modeldata descending outest=modelname ;
model outcome= &continue_vars &class_vars;
output out=modeldata PREDICTED=prob;
run;
proc score data=dataname score=modelname out=dataname type=parms;
var &continue_vars &class_vars;
run;
&class_vars contains categorical variables, in the PROC SCORE, it just keep giveing me error messages, saying those variables (&class_vars) not found:
Thank you!!!
You need to score a logistic model using proc logistic not proc score but since this requires a stored model, not the parameter data set that won't work.
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.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.