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 2001, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 4 Oct 2001 18:04:34 -0600
Reply-To:     Jack Hamilton <JackHamilton@FIRSTHEALTH.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Jack Hamilton <JackHamilton@FIRSTHEALTH.COM>
Subject:      Re: Order in the data step
Comments: To: pete.lund@NWCSR.COM
Content-Type: text/plain; charset=us-ascii

My guess it that it's because SAS uses a one-pass compiler in the data step. Or perhaps it uses a two pass compiler now, but originally used a one pass compiler, and that particular design constraint was left in place.

A hint to what's happening: put the statement

array z _numeric_;

before the SET statement in DATA A:

----- 336 data a; 337 length _numeric_ 3; 338 array z _numeric_; WARNING: Defining an array with zero elements. 339 set x; 340 run; -----

The WARNING message is issued for the same reason that the lengths aren't set.

-- JackHamilton@FirstHealth.com Development Manager, Technical Group METRICS Department, First Health West Sacramento, California USA

>>> "Pete Lund" <pete.lund@NWCSR.COM> 10/04/2001 4:49 PM >>> Howdy all- In a private post Puddin' Man suggested that I be sadistic and ask Ian to explain a twist on one of the previous posts in this thread. I thought I'd go all the way and pose it to all. Why is the behavior of the length statements in the datasteps creating A and B different? The variables in A remain with length 8, while those in B are converted to length 3. BTW - as Puddin' demonstrated earlier, if you move the LENGTH statements after the SET then both the _NUMERIC_ and variable list behave the same.

data x; input var1= var2= var3=; cards; var1=6 var2=8 var3=9 var1=6 var3=9 run;

data a; length _numeric_ 3; set x; run;

data b; length var1 var2 var3 3; set x; run;

proc contents data=a; run; proc contents data=b; run;

---------------------------------------------------------------------------- --- Pete Lund Northwest Crime and Social Research, Inc. 313-D Fifth Ave SE Olympia, WA 98501 (360) 528-8970 - voice (360) 280-4892 - cell (360) 570-7533 - fax pete.lund@nwcsr.com www.nwcsr.com ---------------------------------------------------------------------------- ---


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