comp.soft-sys.sas - The SAS statistics package.
Hi, Sorry if this is in the PROC SQL doc, but I couldn't find it... Test code: data one; length start label $32; input start label; cards; A A A A A B C D ; run; proc sort data=one out=test1 nodupkey; by start; run; proc sql noprint; create view test2 as select distinct start, label from one ; quit; How do I create a PROC SQL view to duplicate the PROC SORT NODUPKEY output? The DISTINCT keyword considers the entire row (start and label together), rather than just start. In the actual application, the SQL views would be permanent views creating cntlin datasets for PROC FORMAT from DB2 tables that could contain repeats of the start value. Thanks, Scott
Hello List, I have a dataset with 8 variables and about 600 entries and am trying to get a table of data without any double entries: proc sort data=D1 nodupkey; by var1; proc sort data=D1 nodupkey; by var2; proc sort data=D1 nodupkey; by var3; proc sort data=D1 nodupkey; by var4; proc sort data=D1 nodupkey; by var5; proc sort data=D1 nodupkey; by var6; proc sort data=D1 nodupkey; by var7; proc sort data=D1 nodupkey; by var8; run; Now, obviously, the order in which I do these sorting steps plays a role in how many datasets there will be in the output table. There are 8! = 40'320 possible orders in which to do this, and I want to find the one that yields the largest possible output dataset. Is there an elegant way to achieve this in SAS? Thanks
Hi All I was wondering if I can do the same thing that proc sort data=ps.psmpl out=x1 nodupkey; by hospid lastnm firstnm; run; is doing in a data step (eventually with even less coding). Thanks Toby
Paul, If just the dups are needed, you could replace OUT=SORTED with OUT=_null_. If the data set is large enough where sorting is not feasible/reasonable, using the hash object would be a way to go. HTH, Ken In a message dated 10/21/2006 9:52:53 AM Eastern Standard Time, XXXX@XXXXX.COM writes: Paul, Would the dupout option (e.g., proc sort data=have out=sorted nodupkey dupout=want) do what you want? Art