Date: Sun, 14 Apr 2002 21:18:47 -0700
Reply-To: Yvette <hollied@OLIN.WUSTL.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Yvette <hollied@OLIN.WUSTL.EDU>
Organization: http://groups.google.com/
Subject: Re: If-Then Else statement(s)
Content-Type: text/plain; charset=ISO-8859-1
Thanks. Worked like a charm :-)
"Andreas Grueninger" <grueninger@ibgrueninger.de> wrote in message news:<a9cb6j$lk2$07$1@news.t-online.com>...
> This is a matter of taste but I would prefer
> - to define a view with the values of gvkeys to delete or to keep
> - and then delete or keep the corresponding records from in.d_Data_master.
>
> LIBNAME in 'c:\test';
> DATA in.d_Data_master;
> sic = 1;
> gvkey = 'A';
> RUN;
> PROC SQL;
> * --- view1 contains all values of gvkeys for which the corresponding
> records should be deleted in
> in.d_Data_master ;
> PROC SQL;
> CREATE VIEW view1 AS
> SELECT DISTINCT gvkey
> FROM in.d_Data_master
> WHERE sic >= 4000 OR 1000 <= sic <= 2000
> ;
> DELETE FROM in.d_Data_master
> WHERE gvkey IN (SELECT gvkey FROM view1)
> ;
> * --- or the same result in one statement ;
> DELETE FROM in.d_Data_master
> WHERE gvkey IN (
> SELECT DISTINCT gvkey
> FROM in.d_Data_master
> WHERE sic >= 4000 OR 1000 <= sic <= 2000
> )
> ;
> QUIT;QUIT;
|