BookmarkSubscribeRSS Feed
Daily1
Quartz | Level 8

 


year revenue State 1 121286 87648 2 142947 103448 3 149822 108641 4 165415 115090 5 185036 126628 6 204693 136616 7 243654 167948 8 278996 187538 9 283190 188971 10 269468 164280 11 333311 220982 12 405678 277584 13 . .

data exam_data;
    input year total_revenue;
    datalines;
1 121286
2 142947
3 149822
4 165415
5 185036
6 204693
7 243654
8 278996
9 283190
10 269468
11 333311
12 405678
13 . 

;
run;

proc reg data = exam_data outest=rec1;
   model total_revenue = year;
     output out=forecast p=predicted;
run;

proc print data=forecast;
run;

 

I am trying to calculate the linear forecast value for 13, but I do not have the Proc Forecast procedure. That's why I'm trying Proc Reg. Please suggest how to find the forecast value of revenue and state columns separately

 

3 REPLIES 3
PaigeMiller
Diamond | Level 26

@Rick_SAS has the answer in the case of linear regression (and similar models)

 

https://blogs.sas.com/content/iml/2014/02/17/the-missing-value-trick-for-scoring-a-regression-model....

--
Paige Miller
Rick_SAS
SAS Super FREQ

>  Please suggest how to find the forecast value of revenue and state columns separately

 

Can you explain what you mean by "separately"? Do you mean that Revenue and State are both response variables, and you want to predict each of them by using a linear model that is fit to the first 12 years of those variables?  If so, just use two MODEL statements, one for Revenue and one for State.

You can do this by making two calls to PROC REG and merging the results, or (since PROC REG is an interactive procedure), by using two MODEL statements in the same call, as shown below.

 

data exam_data;
    input year Revenue State;
    datalines;
1	121286	87648
2	142947	103448
3	149822	108641
4	165415	115090
5	185036	126628
6	204693	136616
7	243654	167948
8	278996	187538
9	283190	188971
10	269468	164280
11	333311	220982
12	405678	277584
13	.	.
;
run;

proc reg data = exam_data outest=rec1;
   var revenue state year;
   model revenue = year;
   output out=forecast1 p=predRevenue;
run;
   model State = year;
   output out=forecast2 p=predState;
quit;

data forecast;
merge forecast1 forecast2;
by year;
run;

proc print data=forecast;
run;

If this is not what you want, then please explain what model you are looking for.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 3 replies
  • 221 views
  • 0 likes
  • 4 in conversation