turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- the product of two datasets in sas

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-19-2017 05:33 PM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-19-2017 05:38 PM

Where do the coefficients come from?

Can you use PROC SCORE to implement this somehow?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-19-2017 06:31 PM

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!!!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-19-2017 08:42 PM

PROC SCORE will handle the categorical variables as long as the data used for scoring is identical, in format, to the input data.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-20-2017 01:24 PM

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!!!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-21-2017 12:09 AM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-19-2017 09:15 PM