```Date: Fri, 16 Jan 2004 16:18:33 -0500 Reply-To: Howard Schreier Sender: "SAS(r) Discussion" From: Howard Schreier Subject: Re: Automatic numeric/character type conversion: suggestions wanted for paper Comments: To: Bruce Gilsen Should be interesting. Right now I have just a couple of quibbles regarding Case #1: I would say that the number is too precise, rather than too big, since the BESTw. format will always preserve magnitude at the sacrifice of significant digits. Consider this: data _null_; do big = 1499, 1501; put big best4. +2 big best3.; end; run; Result: 1499 1E3 1501 2E3 This also demonstrates that the consequence of not having space for all significant digits is rounding rather than truncation. On Thu, 8 Jan 2004 18:54:25 +0000, Bruce F. Gilsen wrote: >Hi, I'm working on a possible future conference paper, and one part is about >problems related to automatic type conversion between numeric and character. >You know, the ubiquitous notes like > > NOTE: Numeric values have been converted to character > values at the places given by: (Line):(Column). > 55:9 > NOTE: Character values have been converted to numeric > values at the places given by: (Line):(Column). > 52:8 > >I've got 2 simple problem cases identified so far. > >1. NUMVAR1 is too big for the BEST12. format, so the value gets >truncated to 1234567.8901. > > data one; > numvar1 = 1234567.8901234; > call symput('macvar1',numvar1); > run; > >2. Before concatenation, NUM1 gets converted to >" 1" (since BEST12. right justifies). >If CHAR1 does not exist or exists with length 13 or greater, >CHAR1 is "2 1" (11 spaces between 2 and 1). If >CHAR1 exists with length 12 or less, CHAR1 is "1". > > data one; > num1=1; > char1 = "2" || num1 ; > >If anyone has any suggestions for other automatic type conversion >problems, I would greatly appreciate hearing from you (on the list, >off-line, whatever). I'll post a summary to the list if I get >off-line suggestions, and of course I'll cite you in the >paper when it gets written. > >Thanks in advance, >Bruce Gilsen >speaking only for myself (and my fantasy baseball team that *almost* won >for the 2nd straight year - I finished 2nd) ```

Back to: Top of message | Previous page | Main SAS-L page