BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Forecaster
Obsidian | Level 7

 

I have the following SAS program. I'm using this data to forecast. I have created dummy variables. I need to create/extend the ausdata to Jan to Dec 2015 with dummy data for ausdata, so I can use it in SAS forecast procedures like arima forecast statement.

 

Question: How do I create a dataset like below when the data ends in Dec 2014.

 

Capture_sas.PNG

 

 

data ausdata;
   input units @@;
   date = intnx( 'month', '01jan2011'd, _n_-1 );
   format date monyy7.;
datalines;
16831 17234 20546 19226 21136 20939 21103 22897 22162 22184 23108 25967
20123 21715 24497 21720 25053 23915 24972 26183 24163 26172 26642 29086
24002 24190 26052 26707 29077 26927 30300 29854 28824 31519 32084 33160
24827 23285 23884 21921 22715 19919 20560 18961 18780 17998 16624 18450
;

run;


data ausdata;
   set ausdata;
   shift2014 =  ( date >= '1jan2014'd );
   ao2014 = ( date = '1may2014'd );
run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Perhaps something like this?

data want;
  set ausdata end=eof;
  output;
  if eof then do offset=1 to intck('month',date,'01DEC2015'd);
    units=.;
    date=intnx('month',date,1);
    shift2014 =  ( date >= '1jan2014'd );
    ao2014 = ( date = '1may2014'd );
    output;
  end;
  drop offset;
run;

View solution in original post

1 REPLY 1
Tom
Super User Tom
Super User

Perhaps something like this?

data want;
  set ausdata end=eof;
  output;
  if eof then do offset=1 to intck('month',date,'01DEC2015'd);
    units=.;
    date=intnx('month',date,1);
    shift2014 =  ( date >= '1jan2014'd );
    ao2014 = ( date = '1may2014'd );
    output;
  end;
  drop offset;
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
  • 757 views
  • 1 like
  • 2 in conversation