BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
cwhittelsey
Calcite | Level 5

Hi all,

 

I have built a regegression in SAS, now i have my coeffiients. I now wish to forecast. I have a table with two columns Date and Variable1. I would like to write in sas the ability to create 2 new columns (1, the output of hte regression - what is y), 2 the cumulative balance. )

 

y=alpha+beta(variable1)

 

alpha and beta are defiend. i wish for the first new column to be the values of y and the second column to be (1+y_t)(1+y_(t-1)

 

i'm having trouble figuring out how to write a loop or macro that enables me to actually build out what woudl be quite easy in excel - just the ability to forecast over time. below is an image that outlines what i'm trying to do. assume the following example.

 

Any help would be very much appreciated

 

 


example.png
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

It helps to have some actual data but this is easy with RETAIN for the cumulative value.

You should also examine the concept of Scoring, applying the regression model to another data set.

 

data want;
   set have;
   retain cumulative .
   y= alpah +beta(variable1);
   cumulative = sum(cumulative,y);
run;

View solution in original post

1 REPLY 1
ballardw
Super User

It helps to have some actual data but this is easy with RETAIN for the cumulative value.

You should also examine the concept of Scoring, applying the regression model to another data set.

 

data want;
   set have;
   retain cumulative .
   y= alpah +beta(variable1);
   cumulative = sum(cumulative,y);
run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1252 views
  • 1 like
  • 2 in conversation