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%92091115515740@UGA.CC.UGA.EDU>
- Newsgroups: bit.listserv.sas-l
- Date: Fri, 11 Sep 1992 15:49:44 EDT
- Reply-To: Howard Schreier <HIS@NIHCU.BITNET>
- Sender: "SAS(r) Discussion" <SAS-L@UGA.BITNET>
- From: Howard Schreier <HIS@NIHCU.BITNET>
- Subject: PRINT Col. Width
- Lines: 63
-
- CONTENT: Comment
- SUMMARY: Interaction of FORMAT & PRINT Seems Curious
-
- > From: "Nelson R. Pardee" <SASMAINT@SUVM.BITNET>
- >
- > About a month ago I wrote to SAS-L:
- > > Without a format, PROC PRINT prints vars using BEST12.-
- > > almost! If it doesn't need 12 columns, it uses fewer. It's
- > > nice that if the values falling on a given page are small,
- > > it uses fewer columns. I have a variable with a wide range
- > > of values- sometimes more than 12 digits, so they are
- > > printed in exponential format, which is unacceptable. I
- > > don't want to use a format statement like format var
- > > BEST15.; since then the variable will be printed using 15
- > > columns even if it doesn't need that many. Any suggestions
- > > on how I can get it to not use exponential format for larger
- > > values, but still use the minimum number of columns?
- >
- > [stuff deleted]
- >
- > 31 proc format; *Now- the solution;
- > 32 value x (default=20) ;
- > ------------------------------------------------------------------
- > 34 proc print data=x;
- > 35 title 'Print numbers w/special format. All digits printed';
- > 36 format x x.;
- >
- > OBS X N
- > 1 10 1
- > 2 123456789012 2
- > 3 1234567890123 3
- > 4 12345678901.3 4
- > 5 123456.7890123 5
- > ------------------------------------------------------------------
- > 39 proc print data=x(where=(n=1));
- > 40 title 'Print 2 digit number w/special format. Uses minimum columns';
- > 41 format x x.;
- >
- > OBS X N
- > 1 10 1
-
- I'm glad that Nelson wound up with a good solution (the
- thoughts I shared with him at the time were basically
- pessimistic), but I'm not quite sure I understand what's
- going on.
-
- I had dismissed the DEFAULT option as a possible solution
- because I interpreted it to mean that "FORMAT X X.;" would
- be processed like "FORMAT X X20.;", which would force PROC
- PRINT to use 20 columns, which is of course the opposite of
- what Nelson wanted to do.
-
- Also, it's curious that "VALUE X (DEFAULT=20) ;" is accepted
- as a complete VALUE statement, since the FM (SAS Procedures
- Guide, V.6, 3rd Ed.) says (p. 291, bottom): "You must
- specify one or more ranges in the VALUE statement."
-
- /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
- \ 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 \
- \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
-