home *** CD-ROM | disk | FTP | other *** search
- Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
- Path: sparky!uunet!paladin.american.edu!auvm!LEICESTER.AC.UK!MAIL_SYSTEM
- Via: uk.ac.leicester; Thu, 20 Aug 1992 09:56:26 +0100
- Message-ID: <SAS-L%92082004562579@VTVM2.BITNET>
- Newsgroups: bit.listserv.sas-l
- Date: Thu, 20 Aug 1992 09:56:00 GMT
- Reply-To: Mail_System@LEICESTER.AC.UK
- Sender: "SAS(r) Discussion" <SAS-L@UGA.BITNET>
- From: Mail_System@LEICESTER.AC.UK
- Subject: %% Undelivered Mail %%
- Comments: To: SAS-L <SAS-L@VTVM2.CC.VT.EDU>
- Lines: 76
-
- Your mail was not delivered as follows:
- Error reason: failed to make connection, entry deleted
-
- Filename and information:
-
- LEIC_WORD:[NETMGR]CBS_0095F5790B71.MAI;1
-
- Your original mail header and message follow.
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- Via: UK.AC.NSFNET-RELAY; Wed, 19 Aug 92 18:52 GMT
- Received: from vtvm2.cc.vt.edu by sun3.nsfnet-relay.ac.uk with Internet SMTP
- id <sg.02696-0@sun3.nsfnet-relay.ac.uk>;
- Wed, 19 Aug 1992 18:24:42 +0100
- Received: from vtvm2.cc.vt.edu by VTVM2.CC.VT.EDU (IBM VM SMTP V2R2) with BSMTP
- id 8324; Wed, 19 Aug 92 13:23:49 EDT
- Received: from VTVM2.BITNET by vtvm2.cc.vt.edu (Mailer R2.08 R208002)
- with BSMTP id 1311; Wed, 19 Aug 92 13:23:39 EDT
- Date: Wed, 19 Aug 1992 12:10:28 -0500
- Reply-To: Kernon Gibes <gibes@COM.MONSANTO.SWIRL>
- Original-Sender: "SAS(r) Discussion" <SAS-L@EDU.VT.CC.VTVM2>
- From: Kernon Gibes <gibes@COM.MONSANTO.SWIRL>
- Subject: RE: SAS functions
- Comments: To: SAS-L@uga.cc.uga.edu@tin.monsanto.com
- Comments: cc: GIBES@tin.monsanto.com
- To: Multiple recipients of list SAS-L <SAS-L@EDU.VT.CC.VTVM2>
- Sender: SAS-L@EDU.VT.CC.VTVM2
-
- CONTENT: Response (to "going back in time")
- SUMMARY: Try SAS function INTNX
- REL/PLTF: 6.07/ VMS
- E-ADDR: gibes@swirl.monsanto.com
- NAME: Kernon Gibes
- DATE: 19 August 1992
-
- Someone asked:
-
- >I am using SAS functions, MOD and ABS. I don't get a right value.
- >I am trying to go to previous year based on the value in MO variable
- >Here is an example:
- <stuff deleted ---but copied below--->
-
- >The value of tst2mo should be equal to NOV (11) and the value of tst2yr
- >should be equal to 75. In another word, I am trying to subtract no. of months
- >reported in "mo" variable from tst1mo tst1yr variables to go back in time.
- >So if my first test date (tst1mo tst1yr) is JANUARY 1977 and I subtract (mo)
- >15 months from it I should get (tst2mo tst2yr) NOVEMBER 1975.
- <stuff deleted>
-
- It seems to me that Jan '77 minus 15 months would give you Oct '75. If
- so, instead of your code, you might use the SAS function INTNX as
- illustrated below:
-
- data one;
- mo = 15;
- tst1mo = 1;
- tst1yr = 77;
- tempmo = mod(mo,12);
- tst2mo = abs(tst1mo - tempmo);
- tempyr = int(mo/12);
- tst2yr = tst1yr - tempyr;
- tst2_dt = mdy(tst2mo,01,tst2yr);
- put 'Original: ' tst2_dt= date7.;
- /*** replace MOD, ABS, etc., with INTNX ***/
- date1 = mdy( tst1mo,01,tst1yr);
- back = intnx( 'month', date1, -mo );
- put 'Corrected: ' back= date7.;
-
- stop;
- run;
-
- Original: TST2_DT=01FEB76
- Corrected: BACK=01OCT75
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- End of returned mail
-