home *** CD-ROM | disk | FTP | other *** search
- Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
- Path: sparky!uunet!uvaarpa!darwin.sura.net!paladin.american.edu!auvm!NIEHS.BITNET!WHITMIR1
- X-Envelope-to: SAS-L@VTVM2.BITNET
- X-VMS-To: IN%"SAS-L@VTVM2.BITNET"
- Message-ID: <01GNRIUQZMF48Y595D@NIEHS.BITNET>
- Newsgroups: bit.listserv.sas-l
- Date: Wed, 19 Aug 1992 11:32:00 EST
- Reply-To: WHITMIR1@NIEHS.BITNET
- Sender: "SAS(r) Discussion" <SAS-L@UGA.BITNET>
- From: WHITMIR1@NIEHS.BITNET
- Subject: SAS functions
- Lines: 24
-
- Hello everyone,
- 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:
- data one;
- set two;
- 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);
- run;
-
- 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.
- I hope this is clear. May be using MOD function is not a good idea.
- Any solution would be apprecieated.
- Thanks in advance.
-