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 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 6 Jul 2005 20:24:15 -0700
Reply-To:     John McQuown <John.McQuown@OTNNET.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         John McQuown <John.McQuown@OTNNET.COM>
Subject:      Re: SUGGESTION: Allow temporary array element as iterative DO
              index              variable.
Comments: To: Jack Hamilton <jfh@STANFORDALUMNI.ORG>
Content-Type: text/plain; charset="us-ascii"

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