| Date: | Thu, 6 Nov 2008 15:34:52 +0100 |
| Reply-To: | Andre Wielki <wielki@INED.FR> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Andre Wielki <wielki@INED.FR> |
| Subject: | Re: If then : evidence ! |
|
| In-Reply-To: | <200811061341.mA6BnWog002116@malibu.cc.uga.edu> |
| Content-Type: | text/plain; charset=ISO-8859-1; format=flowed |
Gerhard
the user was only expecting changing values for 2 variables but
forgetting a ========do; ;end;==========
(in my adapted example i choose sex='2' to show the fact that it was
not change -forget the meaning of the variablename- )
and the consequence was
unexpected change of age and no change at sex
as a result of an (unknown by the user) implicit test (age=10 AND
sex="2") !
The user was expecting age=10 sex="2" for every M of the class!
Andre
Gerhard Hellriegel a écrit :
> ...what did the user expect to get?
> (a very strange method to assign 0...)
> Another idea, to assign 10:
>
> data cl;
> set sashelp.class;
> if sex="M" then age=(10 or sex="2")*10; /*else...;...; */
> run;
>
> or also interesting, to avoid changing anything:
>
> data cl;
> set sashelp.class;
> if sex="M" then age=(10 or sex="2")*age; /*else...;...; */
> run;
>
>
>
> in germany we say (don't know if that is a good translation): to shake the
> haunters off...
>
> Gerhard
>
>
>
> On Thu, 6 Nov 2008 12:09:38 +0100, Andre Wielki <wielki@INED.FR> wrote:
>
>
>> A user here was writing Sas code analogous to this one
>> data cl;
>> set sashelp.class;
>> if sex="M" then age=10 and sex="2"; /*else...;...; */
>> run;
>>
>> As the log was
>>
>> 203 data cl;
>> 204 set sashelp.class;
>> 205 if sex="M" then age=10 and sex="2";
>> 206 run;
>>
>> NOTE: There were 19 observations read from the data set SASHELP.CLASS.
>> NOTE: The data set WORK.CL has 19 observations and 5 variables.
>> NOTE: DATA statement used (Total process time):
>> real time 0.00 seconds
>> cpu time 0.00 seconds
>>
>>
>> He was going further!!!!!!!!!!
>>
>> I hope everybody reading this is aware of the results!
>> If not submit, quick look at the results.
>>
>>
>>
>> Andre
>>
>> --
>> Andr� WIELKI
>> INED (Institut National d'Etudes D�mographiques)
>> Service Informatique
>> 133 Boulevard Davout 75980 Paris Cedex 20
>> m�l : wielki@ined.fr t�l : 33 (0) 1 56 06 21 54
>>
>
>
--
André WIELKI
INED (Institut National d'Etudes Démographiques)
Service Informatique
133 Boulevard Davout 75980 Paris Cedex 20
mél : wielki@ined.fr tél : 33 (0) 1 56 06 21 54
|