|
Proc sort with the nodupkey option does the following:
It sorts, but only outputs the first record in each
BY group. What you get depends on the initial order
of the data.
Such a concept is foreign to SQL, which does not
know anything about the order of rows in the table.
The closest you can get is SELECT DISTINCT (synonym: SELECT
UNIQUE), which corresponds to the NODUP (not NODUPKEY) option
in proc sort.
So you can do a query like
create table data2 as
select distinct State,County,VarA,VarB
from data1
where VarA is not null
order by state,country;
but that would correspond to
proc sort data=Data1(keep=State County VarA VarB ) out=Data2 nodup;
where VarA ne .;
by State County;
run;
which is not quite your original query.
Regards,
Søren
On Thu, 16 Apr 2009 14:48:52 +0000, Christine Arriola
<cmarriola@HOTMAIL.COM> wrote:
>Hi everyone,
>
>
>
>Can anyone tell me how to translate the following sort procedure into
proc SQL?
>
>
>
>proc sort data=Data1(keep=State County VarA VarB ) out=Data2 nodupkey;
>
>where VarA ne .;
>
>by State County;
>
>
>
>I've searched the archive, but I can't seem to find an example that
undups on more than one variable.
>
>
>
>Thanks, Christine
>
>
>
>
>
>
>
>
>_________________________________________________________________
>Windows Live?: Keep your life in sync.
>http://windowslive.com/explore?ocid=TXT_TAGLM_WL_allup_1a_explore_042009
|