home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / bit / listserv / sasl / 4169 < prev    next >
Encoding:
Text File  |  1992-09-11  |  3.0 KB  |  75 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%92091115515740@UGA.CC.UGA.EDU>
  4. Newsgroups: bit.listserv.sas-l
  5. Date:         Fri, 11 Sep 1992 15:49:44 EDT
  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:      PRINT Col. Width
  10. Lines: 63
  11.  
  12. CONTENT:  Comment
  13. SUMMARY:  Interaction of FORMAT & PRINT Seems Curious
  14.  
  15. > From:         "Nelson R. Pardee" <SASMAINT@SUVM.BITNET>
  16. >
  17. > About a month ago I wrote to SAS-L:
  18. > > Without a format, PROC PRINT prints vars using BEST12.-
  19. > > almost! If it doesn't need 12 columns, it uses fewer.  It's
  20. > > nice that if the values falling on a given page are small,
  21. > > it uses fewer columns. I have a variable with a wide range
  22. > > of values- sometimes more than 12 digits, so they are
  23. > > printed in exponential format, which is unacceptable.  I
  24. > > don't want to use a format statement like format var
  25. > > BEST15.; since then the variable will be printed using 15
  26. > > columns even if it doesn't need that many.  Any suggestions
  27. > > on how I can get it to not use exponential format for larger
  28. > > values, but still use the minimum number of columns?
  29. >
  30. > [stuff deleted]
  31. >
  32. > 31         proc format;               *Now- the solution;
  33. > 32          value x (default=20) ;
  34. >  ------------------------------------------------------------------
  35. > 34         proc print data=x;
  36. > 35          title 'Print numbers w/special format. All digits printed';
  37. > 36          format x x.;
  38. >
  39. > OBS          X           N
  40. >  1                 10    1
  41. >  2       123456789012    2
  42. >  3      1234567890123    3
  43. >  4      12345678901.3    4
  44. >  5     123456.7890123    5
  45. >  ------------------------------------------------------------------
  46. > 39 proc print data=x(where=(n=1));
  47. > 40 title 'Print 2 digit number w/special format. Uses minimum columns';
  48. > 41          format x x.;
  49. >
  50. > OBS    X     N
  51. >  1     10    1
  52.  
  53. I'm glad that Nelson wound up  with  a  good  solution  (the
  54. thoughts  I  shared  with  him  at  the  time were basically
  55. pessimistic), but I'm not quite  sure  I  understand  what's
  56. going on.
  57.  
  58. I had dismissed the DEFAULT option as  a  possible  solution
  59. because  I  interpreted it to mean that "FORMAT X X.;" would
  60. be processed like "FORMAT X X20.;", which would  force  PROC
  61. PRINT  to use 20 columns, which is of course the opposite of
  62. what Nelson wanted to do.
  63.  
  64. Also, it's curious that "VALUE X (DEFAULT=20) ;" is accepted
  65. as  a complete VALUE statement, since the FM (SAS Procedures
  66. Guide, V.6, 3rd Ed.) says  (p.   291,  bottom):   "You  must
  67. specify one or more ranges in the VALUE statement."
  68.  
  69. /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  70. \   Howard Schreier, U.S. Dept. of Commerce, Washington    /
  71. /                     MVS 5.18 & 6.07                      \
  72. \   Voice: (202) 377-4180        BITNET: HIS@NIHCU         /
  73. /   Fax:   (202) 377-4614      INTERNET: HIS@CU.NIH.GOV    \
  74. \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  75.