Date: Fri, 14 May 2004 21:06:47 -0400
Reply-To: Lou <lpogodajr292185@COMCAST.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Lou <lpogodajr292185@COMCAST.NET>
Subject: Re: proc sort
"helen" <chenghelen2000@yahoo.com> wrote in message
news:fadc20d0.0405140700.11930b3f@posting.google.com...
> Hello All,
>
> I have a dataset contained some duplicate data. I'd like to delete
> those observations. Normally I use 'proc sort ; by listing vars'
> statement to do it. In my case, there are around 60 variables for one
> observation, I'd like to compare 59 variables to see if it is
> duplicate, instead of list all variables, is there any easy way to do
> it?
>
> Thanks in advance.
If you need a general solution, I think you'll need a couple of steps along
the lines of the following tested code:
PROC SQL NOPRINT;
SELECT NAME INTO :BYVARS SEPARATED BY ' '
FROM DICTIONARY.COLUMNS
WHERE LOWCASE(LIBNAME) = 'your library name here' AND
LOWCASE(MEMNAME) = 'your data set name here' AND
LOWCASE(NAME) ^= 'your excluded variable name here';
QUIT;
PROC SORT DATA = OLD OUT = NEW NODUPKEY;
BY &BYVARS;
QUIT;
Please, I know that at present library names are upper case in the
dictionary tables at present. That used to be the case for variable names
too, and I have no faith that it'll never change.
|