Date: Tue, 25 Oct 2005 15:12:44 -0700
Reply-To: toby989@HOTPOP.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: toby989@HOTPOP.COM
Subject: Re: Saving 3 lines of array declaration/So Concise that it
becomes Scary/proc compare valid?
In-Reply-To: <1130274095.755121.5010@g44g2000cwa.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
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
>
|