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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.