Date: Fri, 6 Feb 2009 13:33:21 -0500
Reply-To: "Wallace, Brian" <Brian.Wallace@ICONPLC.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Wallace, Brian" <Brian.Wallace@ICONPLC.COM>
Subject: INFORMATs vs. FORMATs with regards to INPUT and PUT functions.
Content-Type: text/plain; charset="us-ascii"
Just fair warning to not make the same mistake I just did. When
converting a character to a numeric (C2N), an informat converts the
number differently if there are no decimals involved:
DATA TEST;
INPUT CCC $ NNN;
CARDS;
50 50
27.3 27.3
53 53
83.3 83.3
;
DATA TEST2;
SET TEST;
C2N = INPUT(CCC,6.2);
N2C = PUT(NNN,6.2);
RUN;
PROC PRINT DATA = TEST2;
RUN;
OUTPUT:
OBS CCC NNN C2N N2C
1 50 50.0 0.50 50.00
2 27.3 27.3 27.30 27.30
3 53 53.0 0.53 53.00
4 85.3 83.3 83.30 83.30
You actually have to make the informat 6.0 instead of 6.2. Numeric to
character (N2C) works fine.
Thanks. I intend post to this list much more frequently. Hope I can
help out and add to the discussion.
Brian Wallace
ICON plc made the following annotations.
------------------------------------------------------------------------------
This e-mail transmission may contain confidential or legally privileged information
that is intended only for the individual or entity named in the e-mail address. If you
are not the intended recipient, you are hereby notified that any disclosure, copying,
distribution, or reliance upon the contents of this e-mail is strictly prohibited. If
you have received this e-mail transmission in error, please reply to the sender, so that
ICON plc can arrange for proper delivery, and then please delete the message.
Thank You,
ICON plc
South County Business Park
Leopardstown
Dublin 18
Ireland
Registered number: 145835
|