## How can I calculate the beta of a trend functions over several columns in SAS 9.3?

Occasional Contributor
Posts: 10

# How can I calculate the beta of a trend functions over several columns in SAS 9.3?

How can I calculate the beta of a trend functions over several columns in SAS 9.3?

Super User
Posts: 20,765

## Re: How can I calculate the beta of a trend functions over several columns in SAS 9.3?

What's a beta? Is it the slope?

Can you provide more information, specifically, what does your data look like and what values  you might expect.

Occasional Contributor
Posts: 10

## Re: How can I calculate the beta of a trend functions over several columns in SAS 9.3?

yes, it is the slope. I have account information, and I would like to estimate how the amount changes over time in order to see if the account is active or not. So I have the account information distributed over sever columns according to the month.

Super User
Posts: 20,765

## Re: How can I calculate the beta of a trend functions over several columns in SAS 9.3?

I don't believe there's a single function to do that in SAS.

Other options that come to mind though are variance and checking the number of non missing.

Occasional Contributor
Posts: 10

## Re: How can I calculate the beta of a trend functions over several columns in SAS 9.3?

good point!

But a bit disappointing for SAS - Excel offers this option.

Thank you!

Super User
Posts: 20,765

## Re: How can I calculate the beta of a trend functions over several columns in SAS 9.3?

What function? Slope?

You could transpose your data and run regressions if you were really interested.

Posts: 2,655

## Re: How can I calculate the beta of a trend functions over several columns in SAS 9.3?

The OP could try doing the regressions in PROC GLM. Supposing that the dependent variables are in columns 2 through N, and the independent variable in column 1, and that variables are named by column (e.g. COL_1, COL_2,..., COL_N), then I think the following will give what is needed:

proc glm data=datasetname;

model col_2 - col_n = col_1/solution;

quit;

If there is a desire to consider this as a multivariate analysis, that is pretty easy to gin up from here.

Steve Denham

Occasional Contributor
Posts: 10

## Re: How can I calculate the beta of a trend functions over several columns in SAS 9.3?

Thank you very much - I will try this solution and let you know!

Bernard

Occasional Contributor
Posts: 6

## Re: How can I calculate the beta of a trend functions over several columns in SAS 9.3?

OP, SAS indeed can find the Betas of your variables.  This is an example of one of my regression models:

proc reg data=regress;

model cprod = year q2 q3 q4;

run;

So the 'cprod' is my dependent variable and year, q2, q3, and q4 are my independent variables.

The Betas are going to come through under the section Parameter Estimate along with some other useful stats (t values, p values, etc.)

If I had your variable names, I could be a little more helpful, but this is at least a good start to the Proc Reg capabilities.

Best,

Regulator

Occasional Contributor
Posts: 10

## Re: How can I calculate the beta of a trend functions over several columns in SAS 9.3?

Hi Regulator,

my variables are:

BalanceDic      BalanceJan     BalanceFeb     BalanceMar

and the idea is to estimate the slope of the trend.

Thank you very much and kind regards,

Bernard

Occasional Contributor
Posts: 6

## Re: How can I calculate the beta of a trend functions over several columns in SAS 9.3?

So, my interpretation of your data and what you are trying to do with it is that you have account balances, and their corresponding months.  Thinking about it, your goal would to see that a contributing month's Beta would be zero.  Then if they are zero for several months in a row, you might be able to argue that an account is inactive, is that correct?

If so, do you have data for the entire year? if so, how familiar are you with collinearity and dummy variables?

Occasional Contributor
Posts: 10

## Re: How can I calculate the beta of a trend functions over several columns in SAS 9.3?

Your interpretation is completely correct and I'm pretty familiar with collinearity and dummy variables.

Super User
Posts: 20,765

## Re: How can I calculate the beta of a trend functions over several columns in SAS 9.3?

But you would expect a different slope for every account, wouldn't you.

You can transpose your data and run regressions as I've mentioned above. So change your data to be like the following:

Account Month Balance

Then run a regression

proc reg data=have;

by account;

balance=month;

run;

Or I'm totally missing the point.

Occasional Contributor
Posts: 10

## Re: How can I calculate the beta of a trend functions over several columns in SAS 9.3?

You are not missing the point! I will let you know if it worked.

Occasional Contributor
Posts: 10