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

Showing results for

- Home
- /
- Analytics
- /
- Forecasting
- /
- How to reference regression coefficients?

Options

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

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 11-10-2014 10:10 AM
(1255 views)

Hi,

With data A, I run a regression and save coefficients. Then I start to work with data B. I want to reference the saved coefficients using data A. How can I do that in SAS?

Thanks,

Sunny

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hi Sunny,

The closest we have to this in SAS is utilizing item stores for models estimated by certain models.

Here is an example.

%let nObs = 5000;

%let nVars = 100;

data SimuData;

array x{&nVars};

do obsNum=1 to &nObs;

do j=1 to &nVars;

x{j}=ranuni(1);

end;

linp = 10 + 11*x1 - 10*sqrt(x2) + 2/x3 - 8*exp(x4) + 7*x5*x5

- 6*x6**1.5 + 5*log(x7) - 4*sin(3.14*x8) + 3*x9 - 2*x10;

TrueProb = 1/(1+exp(-linp));

if ranuni(1) < TrueProb then y=1;

else y=0;

output;

end;

run;

proc logistic data=SimuData;

effect splines = spline(x1-x&nVars/separate);

model y = splines/selection=stepwise;

store sasuser.SimuModel;

run;

data test;

array x{&nVars};

do j=1 to &nVars;

x{j}=0.15;

end;

drop j;

output;

run;

proc plm restore=sasuser.SimuModel;

score data=test out=testout predicted / ilink;

run;

data testout;

set testout(drop=x1-x&nVars);

run;

proc print data=testout;

run;

You can find other examples here.

SAS/STAT 13.2 User's Guide Example Programs (Sample Library)

2 REPLIES 2

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hi Sunny,

The closest we have to this in SAS is utilizing item stores for models estimated by certain models.

Here is an example.

%let nObs = 5000;

%let nVars = 100;

data SimuData;

array x{&nVars};

do obsNum=1 to &nObs;

do j=1 to &nVars;

x{j}=ranuni(1);

end;

linp = 10 + 11*x1 - 10*sqrt(x2) + 2/x3 - 8*exp(x4) + 7*x5*x5

- 6*x6**1.5 + 5*log(x7) - 4*sin(3.14*x8) + 3*x9 - 2*x10;

TrueProb = 1/(1+exp(-linp));

if ranuni(1) < TrueProb then y=1;

else y=0;

output;

end;

run;

proc logistic data=SimuData;

effect splines = spline(x1-x&nVars/separate);

model y = splines/selection=stepwise;

store sasuser.SimuModel;

run;

data test;

array x{&nVars};

do j=1 to &nVars;

x{j}=0.15;

end;

drop j;

output;

run;

proc plm restore=sasuser.SimuModel;

score data=test out=testout predicted / ilink;

run;

data testout;

set testout(drop=x1-x&nVars);

run;

proc print data=testout;

run;

You can find other examples here.

SAS/STAT 13.2 User's Guide Example Programs (Sample Library)

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

many thanks!

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

**If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. **

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.