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 2005, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 26 Oct 2005 14:02:15 -0700
Reply-To:     "data _null_;" <datanull@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "data _null_;" <datanull@GMAIL.COM>
Organization: http://groups.google.com
Subject:      Re: Saving 3 lines of array declaration/So Concise that it
              becomes Scary/proc compare valid?
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset="iso-8859-1"

Using SAS 8.2 it does not work.

23 data work.test; 24 array q[20]; 25 do i = 1 to dim(q); 26 q[i] = rantbl(335577,1/3,1/3,1/3); 27 end; 28 run; NOTE: The data set WORK.TEST has 1 observations and 21 variables. 31 data work.test; 32 set work.test; NOTE: SCL source line. 33 if q: ~=. then q: = 0< q: <3; - 388 76 -- 200 ERROR 388-185: Expecting an arithmetic operator. ERROR 76-322: Syntax error, statement will be ignored. ERROR 200-322: The symbol is not recognized and will be ignored. 34 run; NOTE: The SAS System stopped processing this step because of errors. WARNING: The data set WORK.TEST may be incomplete. When this step was stopped there were 0 observations and 21 variables. WARNING: Data set WORK.TEST was not replaced because this step was stopped. NOTE: DATA statement used: real time 0.09 seconds cpu time 0.00 seconds

toby989@hotpop.com wrote: > It may not work in your case since your cooked up dataset may not have > variables in it whose names start with q. I have 38 variable starting > with q and that is what the array is including. > > q: seems to work as an array declaration "on-the-fly". > > Toby > > > Peter wrote: > > doesn't work in my sas9.1.3 > > > > 192 data ps2004dic; > > 193 set ps2004 ; > > 194 if q: ~=. then q: = 0< q: <3; > > - > > 388 > > 76 > > -- > > 200 > > ERROR 388-185: Expecting an arithmetic operator. > > > > ERROR 76-322: Syntax error, statement will be ignored. > > > > ERROR 200-322: The symbol is not recognized and will be ignored. > > > > 195 run; > > > > NOTE: The SAS System stopped processing this step because of errors > > WARNING: The data set WORK.PS2004DIC may be incomplete. When this step > > was stopped there were > > 0 observations and 79 variables. > > WARNING: Data set WORK.PS2004DIC was not replaced because this step was > > stopped. > > NOTE: DATA statement used (Total process tim > > > > > > Interesting that it got as far as thinking it had started running > > > > > > toby989@hotpop.com wrote: > > > >>Hi All > >> > >>Refering to my post on Oct 20, I was looking for a more simple way for > >>my code, got a suggestion (relating to the if statement) and implemented > >>it the following way. > >> > >>data ps2004dic; > >>set psdata.ps2004; > >>array q q:; > >>do over q; > >>if q~=. then q=0<q<3; > >>end; > >>run; > >> > >>Now I experimented some more and found an very concise code that seems > >>almost scary to me. Is following code a valid substitution for the above > >>one - omitting an explicit array declaration? > >> > >>data ps2004dic; > >>set psdata.ps2004; > >>if q: ~=. then q: = 0< q: <3; > >>run; > >> > >>I run a proc compare on both of the resulting datasets and it shows they > >>are exactly the same, however, are there loopholes that proc compare > >>cannot detect? > >> > >>I appreciate comment. > >> > >>Thanks Toby > >> > >> > >> > >> > >> > >> > >> > >> > >> > > > > ............ > > > > no dice in sas9.1.3 > > 192 data ps2004dic; > > 193 set ps2004 ; > > 194 if q: ~=. then q: = 0< q: <3; > > - > > 388 > > 76 > > -- > > 200 > > ERROR 388-185: Expecting an arithmetic operator. > > > > ERROR 76-322: Syntax error, statement will be ignored. > > > > ERROR 200-322: The symbol is not recognized and will be ignored. > > > > 195 run; > > > > NOTE: The SAS System stopped processing this step because of errors > > WARNING: The data set WORK.PS2004DIC may be incomplete. When this step > > was stopped there were > > 0 observations and 79 variables. > > WARNING: Data set WORK.PS2004DIC was not replaced because this step was > > stopped. > > NOTE: DATA statement used (Total process tim > > > > > > Interesting that it got as far as thinking it had started running > >


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