BookmarkSubscribeRSS Feed
CIMS
Calcite | Level 5

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

14 REPLIES 14
Reeza
Super User

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.

CIMS
Calcite | Level 5

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.

Reeza
Super User

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.

CIMS
Calcite | Level 5

good point!

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

Thank you!

Reeza
Super User

What function? Slope?

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

SteveDenham
Jade | Level 19

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

CIMS
Calcite | Level 5

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

Bernard

DasRegulator
Calcite | Level 5

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

CIMS
Calcite | Level 5

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

DasRegulator
Calcite | Level 5

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?

CIMS
Calcite | Level 5

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

Reeza
Super User

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.

CIMS
Calcite | Level 5

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

CIMS
Calcite | Level 5

at this moment we just took data for 4 month, but we could increase the numbers of the months.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 14 replies
  • 1956 views
  • 0 likes
  • 4 in conversation