LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 2004, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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?

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