Help using Base SAS procedures

Convert mid month date to month end date

Reply
N/A
Posts: 0

Convert mid month date to month end date

I'm reading in a text file that contains a date paid field that can be any day of the month -- I want to convert that date to the end of the month date: for example

record 1, date paid 05/12/2009, mthend 05/31/2009
record 2, date paid 05/19/2009, mthend 05/31/2009
record 3, date paid 06/02/2009, mthend 06/30/2009

what is the sas procedure code that would do this for me? Thanks.
Super Contributor
Super Contributor
Posts: 3,174

Re: Convert mid month date to month end date

Posted in reply to deleted_user
Have a look at using the INTNX function for this purpose.

Scott Barry
SBBWorks, Inc.
N/A
Posts: 0

Re: Convert mid month date to month end date

Thanks for the hints.
SAS Employee
Posts: 3

Re: Convert mid month date to month end date

Posted in reply to deleted_user
INTNX would be the correct procedure for this. This procedure can return beginning, middle and/or end of the chosen period. Sample syntax is:

data temp;
format bill_date date9.;
input bill_date mmddyy10.;
datalines;
05/12/2009
05/19/2009
06/02/2009
;

data temp2;
set temp;
format month_end date9.;

month_end = INTNX( 'month',bill_date,0,'END');

run;
Ask a Question
Discussion stats
  • 3 replies
  • 5966 views
  • 1 like
  • 3 in conversation