home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!utcsri!torn!nott!dgbt!netfs!ub!zaphod.mps.ohio-state.edu!darwin.sura.net!paladin.american.edu!auvm!PHPDLS1.EM.CDC.GOV!RJF2
- From: rjf2@PHPDLS1.EM.CDC.GOV
- Newsgroups: bit.listserv.sas-l
- Subject: proc FORMAT: oops on numeric values
- Message-ID: <2B021F19@router.em.cdc.gov>
- Date: 12 Nov 92 18:07:00 GMT
- Sender: "SAS(r) Discussion" <SAS-L@UGA.BITNET>
- Reply-To: rjf2@PHPDLS1.EM.CDC.GOV
- Lines: 71
- Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
- X-Delivery-Notice: SMTP MAIL FROM does not correspond to sender.
- Return-Path: rjf2@PHPDLS1.EM.CDC.GOV
- Encoding: 75 TEXT
- X-Mailer: Microsoft Mail V3.0 (beta-2)
- Comments: To: SAS-L@UGA.BITNET, vpm1@OPSIRM1.EM.CDC.GOV
-
- content : Question
- summary : proc FORMAT: improper formatting
- rlse/platform: V6.07 / MVS
-
- Hello, crew: I need some help understanding what is happening with the FORMAT
- that I am using to show percents from proc FREQ.
-
- **************************************************************************
- My Questions are:
- what options in proc FORMAT do I jiggle to get my reports correct?
- or
- what do I need to do to my FREQ SSD Percent value so that it will be
- formatted correctly?
- **************************************************************************
-
- My usual usage is to store the output SSD from proc FREQ and print it later
- using a DATA _NULL_. Since I put only 3 digits in the report, I created a
- format for (99..100) = '>99'. 99% and 100% are supposed to be shown exactly
- and values between 99 and 100 and supposed to be shown as '>99' %.
-
- I have been using this format for 4 years; it was written in V5.16 and worked
- successfully through 5.18 and 6.06. Today, I am not pleased with it.
-
-
- Here is test code which shows the difference between a numeric value created
- by SAS and another supposedly equal numeric value, which is formated
- correctly:
-
- *RJF2.MPEPHTLV.P9205PGM(ZPERCENT)
- *RJF2:92Nov12 test of Percent format working incorrectly;
- options nocenter;
- proc FORMAT; value PCNT /*(fuzz=.0005)*/ 99 <-< 100 = '>99' ;
-
- DATA SAS_N ;
- do SAS_N = 98.999 to 99.001 by 0.001,
- 99.999 to 100.001 by 0.001 ;
- SAS_Frmt = SAS_N;
- %LET W = 7;
- %LET D = %eval(&W - 4);
- * format SAS_N &W..&D ;
- C = put(SAS_N ,&W..&D);
- N = input(C ,&W..&D);
- N_Frmt = N;
- NeqSAS_N= (SAS_N = N);
- output; end;
-
- proc PRINT;
- format SAS_Frmt N_frmt pcnt. ;
-
- Here is the OUTPUT:
-
- OBS SAS_N SAS_FRMT C N N_FRMT NEQSAS_N
-
- 1 98.999 99 98.999 98.999 99 1
- 2 99.000 >99 99.000 99.000 99 0
- 3 99.001 >99 99.001 99.001 >99 0
- 4 99.999 >99 99.999 99.999 >99 1
- 5 100.000 >99 100.000 100.000 100 0
- 6 100.001 100 100.001 100.001 100 0
-
- ************************************************************************
- Values for N are formatted correctly under N_FRMT.
-
- Note that obs 2 and 5 for SAS_N are formatted incorrectly under SAS_FRMT.
-
- Any help, opinions, direction, guidance, etc, will be appreciated.
-
- Ron Fehd : SMTP:BitNet: <rjf2@phpdls1.em.cdc.gov>
- Centers for Disease Control
- 1600 Clifton Rd MS:G25 FAX : 404/639-1778
- Atlanta, GA 30333 USA phone: 404/639-1707
-