home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / bit / listserv / sasl / 5743 < prev    next >
Encoding:
Text File  |  1993-01-25  |  2.5 KB  |  63 lines

  1. Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
  2. Path: sparky!uunet!paladin.american.edu!auvm!NIHCU.BITNET!HIS
  3. Message-ID: <SAS-L%93012507254206@UGA.CC.UGA.EDU>
  4. Newsgroups: bit.listserv.sas-l
  5. Date:         Mon, 25 Jan 1993 07:23:08 EST
  6. Reply-To:     Howard Schreier <HIS@NIHCU.BITNET>
  7. Sender:       "SAS(r) Discussion" <SAS-L@UGA.BITNET>
  8. From:         Howard Schreier <HIS@NIHCU.BITNET>
  9. Subject: Re: CHANGING SIGN (+/-) IN SAS 6/07 - VMS
  10. Lines: 51
  11.  
  12. CONTENT:  Follow-up
  13. SUMMARY:  DATA step view lets you have it both ways
  14. REL/PLTF: 6.07+
  15.  
  16. Original question:
  17.  
  18. > I have a SAS data set containing financial data in which
  19. > revenue is a negative number and expense is a positive
  20. > number.  Although the accountants understand this it
  21. > confounds any other users who try to make sense of reports
  22. > derived from the data set.  Is there a way to reverse the
  23. > sign for all values of selected variables.  I could not do
  24. > so for all numeric variables since I have a couple of
  25. > numeric variables which are not dollar amounts.  I was not
  26. > able to find any way to do this from any available SAS
  27. > documentation.
  28.  
  29. Later posting:
  30.  
  31. > Thanks to those who responded to my question about how to
  32. > change the sign of some variables in a financial data set.
  33. > The array suggestions probably would work but Jim from Notre
  34. > Dame makes me embarrassed I asked by suggesting just to
  35. > multiply by minus 1!!!
  36. >
  37. > I made the cardinal mistake of forgetting the K.I.S.S.
  38. > theory of coding (Keep it Simple Stupid!).
  39.  
  40. The transformation itself is even simpler, since  the  unary
  41. minus  operator  should  suffice;  that is, "x = -x;" rather
  42. than "x = (-1)*x;".
  43.  
  44. As a separate issue, I would code an ARRAY  and  a  DO  loop
  45. unless  there  are  just  a handful of variables and you are
  46. sure that you won't be going in later to add more.  I  would
  47. be  worried about accidentally coding "x = -y;", which would
  48. be easy to do and perhaps hard to catch.
  49.  
  50. This seems like perhaps a perfect situation for a DATA  step
  51. *view* (see Tech.  Report P-222).  The accountants could see
  52. the original, which would adhere to their  sign  convention;
  53. others could use the view, with the signs flipped.  However,
  54. there would really  be  just  one  data  set  to  store  and
  55. maintain.
  56.  
  57. /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  58. \   Howard Schreier, U.S. Dept. of Commerce, Washington    /
  59. /                     MVS 5.18 & 6.07                      \
  60. \   Voice: (202) 377-4180        BITNET: HIS@NIHCU         /
  61. /   Fax:   (202) 377-4614      INTERNET: HIS@CU.NIH.GOV    \
  62. \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  63.