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;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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