|
On 19 Maio, 11:45, RolandRB <rolandbe...@hotmail.com> wrote:
> On May 19, 12:27 pm, Nanita <susana.urb...@gmail.com> wrote:
>
>
>
> > Hi there,
>
> > I'me havind some trouble summing some dates.
>
> > I have a table with a column with Begin_Date and another colunm with
> > Maturity_Lenght.
>
> > I need to create another column with the End_Date, by adding the
> > Maturity_Lenght to the Begin_Date.
>
> > Begin_Date Maturity_Lenght (month) End_Date
>
> > 02-05-2008 1
> > 02-06-2008
>
> > 05-05-2008 3
> > 05-08-2008
> > .....
>
> > How can I do that?
>
> > Thank you so much.
>
> In the following case I am adding 3 months to dt to get dt2.
>
> 13 data _null_;
> 14 format dt dt2 date9.;
> 15 dt="05jun2008"d;
> 16 dt2=mdy(month(dt)+3,day(dt),year(dt));
> 17 put dt2=;
> 18 run;
>
> dt2=05SEP2008
> NOTE: DATA statement used:
> real time 0.00 seconds
> cpu time 0.00 seconds
Thanks you for you answer.
But I'm trying to do something like that, and it doesn't work:
data mylib.txcp_copy;
SET mylib.txcurtoprazo;
IF Prazo='D01' THEN DO
End_Date=Begin_date+1;
END;
IF Prazo='D07' THEN DO
End_Date=Begin_date+7;
END;
IF Prazo='D14' THEN DO
End_Date=Begin_date+14;
END;
/* I want that every End_dates of a data with Prazo = M03 it's a sum
of Begin_date plus 3*/
IF Prazo='M03' THEN DO
End_Date=mdy(month(Begin_date)+3,day(Begin_date),year(Begin_date));
END;
run;
|