```Date: Thu, 21 Nov 1996 16:59:04 +0500 Reply-To: Bernard Tremblay Sender: "SAS(r) Discussion" From: Bernard Tremblay Subject: Re: DATES Hi Paul and all, You may want to use the facilities of SAS to calculate any interval you want to. First, you have to transform your date into a SAS date; Next, you have to call intck to calculate the difference between your dates. Here is an example: .... you are already in a data step and your variables monthn, yearn,... are in character: d1=input(year1||month1||'01', yymmdd6.); d2=input(year2||month2||'01', yymmdd6.); diff=intck('month',d1,d2); et voila! Note that you have the variable diff contains an integer number of month. Regards, Bernard \\\|/// \\ - - // ( @ @ ) +------oOOo-(_)-oOOo----------+---------------------------------+ | Bernard Tremblay | Bureau: (418) 646-2401 | | La Capitale | Maison: (418) 878-4447 | | |Internet: bernard@capitale.qc.ca | | | bertrem@quebectel.com | +---------------Oooo----------+---------------------------------+ oooO ( ) ( ) ) / \ ( (_/ \_) >>>From owner-sas-l@UGA.CC.UGA.EDU Thu Nov 21 16:43 EST 1996 >>>Date: Thu, 21 Nov 1996 16:38:20 -0500 >>>From: Ismail Parsa x6734 >>>Subject: Re: DATES >>>To: Multiple recipients of list SAS-L >>> >>>|> >>>|> Hi >>>|> I have a dataset with 4 variables........which I can make numeric or >>>|> character..depending on how easy isto solve theproblem I have... >>>|> >>>|> I have month1 with values a la "mm" and year1 with values >>>|> a la "yy".......simply a variable for month and another one for >>>|> year... >>>|> ie: month1 = 05 and year1 = 89; >>>|> >>>|> I also have 2 other variables month2 and year2 with similar type of >>>|> values... >>>|> >>>|> The user wants me to give him a report of the time elapsed between >>>|> month1 year1 and month2 year2 in MONTHS....... >>>|> >>>|> the application was written sometime ago..and I can modify that.... >>>|> all i have is an ASCII file with those values.... >>>|> >>>|> Can someone give me some idea on how to code the date >>>|> calculation? >>>|> I can make the values numeric or charcters to simplify the >>>|> calcuation. >>>|> >>>|> I will appreciate any assistance with this... >>>|> >>> ```

Back to: Top of message | Previous page | Main SAS-L page