DATA Step, Macro, Functions and more

How do I create 6 more rows using one row using SAS

Reply
Contributor
Posts: 40

How do I create 6 more rows using one row using SAS

Hi,

I'm forecasting a variable on a weekly basis. But my requirement is daily basis. So I'm forecasting for one week and dividing that value into 7 parts for the successive dates.

My question is how do I create 6 more rows with different dates using one row data.

Please refer to the attached pics:

first one is Current Output and the next one is required output.

Kindly throw some light.

Thanks,

Naresh

BELTWAY REGIONCDVCONNECTBUSINESSQTY5/3/2015.442.1057
BELTWAY REGIONCDVCONNECTBUSINESSQTY5/10/2015.421.6068
BELTWAY REGIONCDVCONNECTBUSINESSQTY5/3/2015.442.1057
BELTWAY REGIONCDVCONNECTBUSINESSQTY5/4/201563.15795
BELTWAY REGIONCDVCONNECTBUSINESSQTY5/5/201563.15795
BELTWAY REGIONCDVCONNECTBUSINESSQTY5/6/201563.15795
BELTWAY REGIONCDVCONNECTBUSINESSQTY5/7/201563.15795
BELTWAY REGIONCDVCONNECTBUSINESSQTY5/8/201563.15795
BELTWAY REGIONCDVCONNECTBUSINESSQTY5/9/201563.15795
BELTWAY REGIONCDVCONNECTBUSINESSQTY5/10/2015.421.6068
BELTWAY REGIONCDVCONNECTBUSINESSQTY5/11/201560.22954
BELTWAY REGIONCDVCONNECTBUSINESSQTY5/12/201560.22954
BELTWAY REGIONCDVCONNECTBUSINESSQTY5/13/201560.22954
BELTWAY REGIONCDVCONNECTBUSINESSQTY5/14/201560.22954
BELTWAY REGIONCDVCONNECTBUSINESSQTY5/15/201560.22954
BELTWAY REGIONCDVCONNECTBUSINESSQTY5/16/201560.22954
Super Contributor
Posts: 275

Re: How do I create 6 more rows using one row using SAS

Posted in reply to NareshAbburi

data have;

input (v1-v6)($) date mmddyy10. num;

format date mmddyy10.;

cards;

BELTWAY REGION CDV CONNECT BUSINESS QTY 5/3/2015 442.1057

BELTWAY REGION CDV CONNECT BUSINESS QTY 5/10/2015 421.6068

;

run;

data want(rename=(_num=num _date=date));

   set have;

   do i=0 to 6;

      if i=0 then do;

      _date=date;

  _num=num;

  num=num/7;

  output;

    end;

    else do;

       _date=intnx('day',date,i);

   _num=num;

   output;

  end;

  end;

  format _date mmddyy10.;

drop num date i;

run;

Ask a Question
Discussion stats
  • 1 reply
  • 160 views
  • 0 likes
  • 2 in conversation