home *** CD-ROM | disk | FTP | other *** search
- Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
- Path: sparky!uunet!gatech!paladin.american.edu!auvm!NIHCU.BITNET!HIS
- Message-ID: <SAS-L%92082812371651@UGA.CC.UGA.EDU>
- Newsgroups: bit.listserv.sas-l
- Date: Fri, 28 Aug 1992 12:36:08 EDT
- Reply-To: Howard Schreier <HIS@NIHCU.BITNET>
- Sender: "SAS(r) Discussion" <SAS-L@UGA.BITNET>
- From: Howard Schreier <HIS@NIHCU.BITNET>
- Subject: Re: Duplicates
- Lines: 57
-
- CONTENT: Follow-up & Comment
- SUMMARY: Add a variable at end of PDV
-
- The problem, in brief: printing duplicate observations from
- a data set having a large number of variables.
-
- I'm no Kernon/Andy, so I'll stay away from the SQL :-) and
- stick with classic SAS. Tom Abernathy (tom@msvax.mssm.edu)
- suggested a clever approach:
-
- > This is a simple problem, if you know the LAST variable in the data
- > vector. And if you want to take the time to sort it.
- >
- > PROC SORT;
- > BY _ALL_;
- > DATA dups;
- > SET;
- > BY _ALL_;
- > if not (first.Z and last.Z); * Where Z is the last variable ;
- > run;
- >
- > I tested this on VM/CMS version 6.07 of SAS.
-
- I'm always a bit uncomfortable about relying on variable
- positions within the vector. It's also harder to generalize
- (as for a macro).
-
- How about adding a variable which would then reliably become
- the last one. Give it missing values so that it would not
- mess up the BY sequence or the testing for duplicates.
- Between Tom's two steps, insert:
-
- data tocheck; set; __extra = .;
-
- Note the double underscore at the beginning of the name. If
- you follow the convention of never using such names in
- permanently stored data sets, it's pretty safe.
-
- The subsetting IF becomes:
-
- if not (first.__extra and last.__extra);
- drop __extra;
-
- Under 6.07, I would make TOCHECK a DATA step *view*, which
- would save some resource usage.
-
- By the way, I think the very active and rapid exchange of
- suggestions on this question today has been pretty
- impressive. It certainly makes the case for posting rather
- than replying privately, and for an unmoderated list.
-
- /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
- \ Howard Schreier, U.S. Dept. of Commerce, Washington /
- / MVS 5.18 & 6.07 \
- \ Voice: (202) 377-4180 BITNET: HIS@NIHCU /
- / Fax: (202) 377-4614 INTERNET: HIS@CU.NIH.GOV \
- \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
-