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 REGION | CDV | CONNECT | BUSINESS | QTY | 5/3/2015 | . | 442.1057 |
BELTWAY REGION | CDV | CONNECT | BUSINESS | QTY | 5/10/2015 | . | 421.6068 |
BELTWAY REGION | CDV | CONNECT | BUSINESS | QTY | 5/3/2015 | . | 442.1057 |
BELTWAY REGION | CDV | CONNECT | BUSINESS | QTY | 5/4/2015 | 63.15795 | |
BELTWAY REGION | CDV | CONNECT | BUSINESS | QTY | 5/5/2015 | 63.15795 | |
BELTWAY REGION | CDV | CONNECT | BUSINESS | QTY | 5/6/2015 | 63.15795 | |
BELTWAY REGION | CDV | CONNECT | BUSINESS | QTY | 5/7/2015 | 63.15795 | |
BELTWAY REGION | CDV | CONNECT | BUSINESS | QTY | 5/8/2015 | 63.15795 | |
BELTWAY REGION | CDV | CONNECT | BUSINESS | QTY | 5/9/2015 | 63.15795 | |
BELTWAY REGION | CDV | CONNECT | BUSINESS | QTY | 5/10/2015 | . | 421.6068 |
BELTWAY REGION | CDV | CONNECT | BUSINESS | QTY | 5/11/2015 | 60.22954 | |
BELTWAY REGION | CDV | CONNECT | BUSINESS | QTY | 5/12/2015 | 60.22954 | |
BELTWAY REGION | CDV | CONNECT | BUSINESS | QTY | 5/13/2015 | 60.22954 | |
BELTWAY REGION | CDV | CONNECT | BUSINESS | QTY | 5/14/2015 | 60.22954 | |
BELTWAY REGION | CDV | CONNECT | BUSINESS | QTY | 5/15/2015 | 60.22954 | |
BELTWAY REGION | CDV | CONNECT | BUSINESS | QTY | 5/16/2015 | 60.22954 |
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;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.