home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / bit / listserv / sasl / 3787 < prev    next >
Encoding:
Text File  |  1992-08-19  |  1.3 KB  |  38 lines

  1. Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
  2. Path: sparky!uunet!uvaarpa!darwin.sura.net!paladin.american.edu!auvm!NIEHS.BITNET!WHITMIR1
  3. X-Envelope-to: SAS-L@VTVM2.BITNET
  4. X-VMS-To: IN%"SAS-L@VTVM2.BITNET"
  5. Message-ID: <01GNRIUQZMF48Y595D@NIEHS.BITNET>
  6. Newsgroups: bit.listserv.sas-l
  7. Date:         Wed, 19 Aug 1992 11:32:00 EST
  8. Reply-To:     WHITMIR1@NIEHS.BITNET
  9. Sender:       "SAS(r) Discussion" <SAS-L@UGA.BITNET>
  10. From:         WHITMIR1@NIEHS.BITNET
  11. Subject:      SAS functions
  12. Lines: 24
  13.  
  14. Hello everyone,
  15. I am using SAS functions, MOD and ABS. I don't get a right value.
  16. I am trying to go to previous year based on the value in MO variable
  17. Here is an example:
  18. data one;
  19.  set two;
  20. mo = 15;
  21. tst1mo = 1;
  22. tst1yr = 77;
  23. tempmo = mod(mo,12);
  24. tst2mo = abs(tst1mo - tempmo);
  25. tempyr = int(mo/12);
  26. tst2yr = tst1yr - tempyr;
  27. tst2_dt = mdy(tst2mo,01,tst2yr);
  28. run;
  29.  
  30. The value of tst2mo should be equal to NOV (11) and the value of tst2yr
  31. should be equal to 75.  In another word, I am trying to subtract no. of months
  32. reported in "mo" variable from tst1mo tst1yr variables to go back in time.
  33. So if my first test date (tst1mo tst1yr) is JANUARY 1977 and I subtract (mo)
  34. 15 months from it I should get (tst2mo tst2yr) NOVEMBER 1975.
  35. I hope this is clear.  May be using MOD function is not a good idea.
  36. Any solution would be apprecieated.
  37. Thanks in advance.
  38.