f



Re: Create date time series #2

Dan already provide a good solution. In case you are not familiar
with the date/time functions, here is how you can get the year,month,
day and hour:

data want;
do dt='01Jan05:00:00'dt to '31Dec07:23:59'dt by 3600;
year=year(datepart(dt));
month=month(datepart(dt));
day=day(datepart(dt));
hour=hour(timepart(dt));
output;
end;
drop dt;
run;

proc print;
run;

On Thu, 13 Mar 2008 15:35:46 +1100, anthony hansen
<sunny_coast@LIVE.COM.AU> wrote:

>Hi All
>
>I am wanting to create a time series starting 01Jan05 and finishing
31Dec07.
>
>This is an example of how it should look - note the first hour of the day
needs to start on '0' and the last needs to be '23'.
>
>YEAR MONTH DAY HOUR
>2005 1 1 0
>. . . .etc
>2005 1 1 10
>. . . .etc
>2005 1 1 23
>2005 1 2 0
>. . . .etc
>2007 12 31 23
>
>TIA
>Anthony
>_________________________________________________________________
>It's simple! Sell your car for just $30 at CarPoint.com.au
>http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fsecure%2Dau%2Eimrworldwide%
2Ecom%2Fcgi%2Dbin%2Fa%2Fci%5F450304%2Fet%5F2%2Fcg%5F801459%2Fpi%5F1004813%
2Fai%5F859641&_t=762955845&_r=tig_OCT07&_m=EXT
0
ya.huang (1962)
3/13/2008 5:35:55 AM
comp.soft-sys.sas 142827 articles. 4 followers. Post Follow

0 Replies
643 Views

Similar Articles

[PageSpeed] 35

Reply: