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