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 (July 2005, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Sat, 9 Jul 2005 10:17:17 -0700
Reply-To:   Jack Hamilton <jfh@STANFORDALUMNI.ORG>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Jack Hamilton <jfh@STANFORDALUMNI.ORG>
Subject:   Re: SUGGESTION: Allow temporary array element as iterative DO index variable.
Comments:   To: John McQuown <John.McQuown@OTNNET.COM>
In-Reply-To:   <5EFEE0A95CCEEC408CCE5BFD2AF87FB0010CB2A0@CBA0E2K04.CBA0.centerbeam.com>
Content-Type:   text/plain; charset="us-ascii"

Based on the previous discussions we've had about this, I think you're right; I still don't want it to work that way.

> -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On > Behalf Of John McQuown > Sent: Thursday, July 07, 2005 11:01 am > To: SAS-L@LISTSERV.UGA.EDU > Subject: Re: [SAS-L] SUGGESTION: Allow temporary array > element as iterative DO index variable. > > Right on, Jim! SAS has two variable rosters for the DATA > step: one for > internal, unnamed, temporary memory (the "heap") and one for external, > named, permanent (or potentially permanent) memory. > > Note: FIRST.BY and LAST.BY variables are example of other DATA step > internal, temporary variables. > > Cheers, john > > -----Original Message----- > From: Jim Groeneveld [mailto:jim1stat@YAHOO.CO.UK] > Sent: Thursday, July 07, 2005 12:32 AM > To: SAS-L@LISTSERV.UGA.EDU; John McQuown > Subject: Re: SUGGESTION: Allow temporary array element as iterative DO > index variable. > > Hi John and Jack, > > I think it is due to the fact that the iterative DO statement does not > allow array element names as the index variable. Neither NON-temporary > array elements may be specified. > > Furthermore you can not specify X1 here for a temporary array element, > as > the SAS 8.2 online doc says "They do not have names. Refer to > temporary > data elements by the array name and dimension." > > Not only are temporary array elements not saved in an output dataset, > they > neither are included in the _ALL_ (and _NUMERIC_ or _CHARACTER_) name > lists > as the following example shows: > > 1 data test; > 2 array x[1] _temporary_ (22); > 3 put 'Before loop!' (_ALL_)(=); > 4 do x1 = 1 to 3; > 5 put 'Within loop!' (_ALL_)(=); > 6 end; > 7 run; > > Before loop! > Within loop!x1=1 > Within loop!x1=2 > Within loop!x1=3 > NOTE: The data set WORK.TEST has 1 observations and 1 variables. > NOTE: DATA statement used: > real time 0.02 seconds > cpu time 0.02 seconds > > > Regards - Jim. > -- > Y. (Jim) Groeneveld, MSc., Biostatistician, Vitatron b.v., NL > Jim.Groeneveld_AT_Vitatron.com (replace _AT_ by AT sign) > http://www.vitatron.com, http://home.hccnet.nl/jim.groeneveld > > My computer always teaches me something new I thought I knew already. > > [common disclaimer] > > On Wed, 6 Jul 2005 20:24:15 -0700, John McQuown > <John.McQuown@OTNNET.COM> > wrote: > > >I think it is because the temporary variable is not in the permanent > >variable list and not subject to all the overhead that SAS > provides for > >managing permanent variables. > > > >For example, see the first and second variations of your demo, below. > >You can track these memory usage differences if you turn on OPTIONS > >FULLSTIMER; > > > >Cheers, john > > > >1109 options fullstimer; > >1110 > >1111 data _null_; > >1112 array x{1} x1 (3); > >1113 do i = 1 to x{1}; > >1114 put 'hi!'; > >1115 end; > >1116 run; > >hi! > >hi! > >hi! > >NOTE: DATA statement used: > > real time 0.00 seconds > > user cpu time 0.00 seconds > > system cpu time 0.00 seconds > > Memory 104k > >1117 > >1118 data _null_; > >1119 array x{1} _temporary_; > >1120 x{1} = 3; > >1121 do i = 1 to x{1}; > >1122 put 'hi!'; > >1123 end; > >1124 run; > >hi! > >hi! > >hi! > >NOTE: DATA statement used: > > real time 0.01 seconds > > user cpu time 0.01 seconds > > system cpu time 0.00 seconds > > Memory 88k > >1125 > >1126 data _null_; > >1127 array x{1} _temporary_; > >NOTE: SCL source line. > >1128 do x{1} = 1 to 3; > > - > > 73 > > 76 > >ERROR 73-322: Expecting an =. > >ERROR 76-322: Syntax error, statement will be ignored. > >1129 put 'hi!'; > >1130 end; > >1131 run; > >NOTE: The SAS System stopped processing this step because of errors. > >NOTE: DATA statement used: > > real time 0.00 seconds > > user cpu time 0.00 seconds > > system cpu time 0.00 seconds > > Memory 34k > > > > > >-----Original Message----- > >From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of > >Jack Hamilton > >Sent: Wednesday, July 06, 2005 8:00 PM > >To: SAS-L@LISTSERV.UGA.EDU > >Subject: SUGGESTION: Allow temporary array element as iterative DO > index > >variable. > > > >I can't think of a good reason why this should be allowed: > > > >===== > >1 data _null_; > >2 array x[1] _temporary_; > >3 x[1] = 3; > >4 do i = 1 to x[1]; > >5 put 'hi!'; > >6 end; > >7 run; > > > >hi! > >hi! > >hi! > >NOTE: DATA statement used (Total process time): > > real time 0.28 seconds > > cpu time 0.06 seconds > >===== > > > >but not this: > > > >===== > >8 > >9 data _null_; > >10 array x[1] _temporary_; > >11 do x[1] = 1 to 3; > > - > > 73 > > 76 > >ERROR 73-322: Expecting an =. > > > >ERROR 76-322: Syntax error, statement will be ignored. > > > >12 put 'hi!'; > >13 end; > >14 run; > > > >NOTE: The SAS System stopped processing this step because of errors. > >NOTE: DATA statement used (Total process time): > > real time 0.07 seconds > > cpu time 0.00 seconds > >===== > > > > > >-- > >Jack Hamilton > >Sacramento, California >


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