Date: Thu, 21 Oct 2004 12:53:54 -0400
Reply-To: Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Subject: Informat Widths (DATA step vs. SQL)
When I run this code:
proc sql;
select input(put(99,8.),$2.) as _99
from sashelp.class;
quit;
I get a column of 99's.
When I run an equivalent DATA step:
data samething;
set sashelp.class(drop=_all_);
_99 = input(put(99,8.),$2.);
run;
I get all blanks. That makes sense, because the PUT function generates a
string with two 9's right justified in an 8-character string but the INPUT
function only scans the first 2 characters vecause of the width specified
for the informat.
So why does SQL find those two digits and propagate them into the result?
Why is this expression evaluated differently in the two contexts?
|