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;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 218 views
  • 1 like
  • 2 in conversation