how do we get duplicate observations in a separate dataset?
Answers were Sorted based on User's Feedback
Answer / bitla
ex:
data dup1 dup2;
set original;
by dup_var;
if first.dup_var then output dup1 else output dup2;
run;
Is This Answer Correct ? | 11 Yes | 0 No |
Answer / mallikarjuna reddy.vanna
use DUPOUT option in proc sort statement.
Is This Answer Correct ? | 12 Yes | 1 No |
Answer / natrajboga
use the dupout= and nodupkey options in proc sort and
followed by BY statemet with list of vars
proc sort data=xxx dupout=dup_xxx nodupkey;
by var1;
run;
/* see the log window */
proc print data=dup_xxx;
run;
Is This Answer Correct ? | 8 Yes | 0 No |
Answer / vipin choudhary
Proc sort data = indata;
by name;
run;
Data outdata;
set indata;
by name;
if first.name and last.name then delete;
run;
proc print data = outdata;
run;
or else you can use the dupout option in proc sort
Is This Answer Correct ? | 4 Yes | 2 No |
First sort them in descending order and then using first.var
separate all the first observations into a new dataset and
the remaining into another. So unique observations from each
group
will come into one dataset and the other duplicate
observations will enter into another dataset.
Is This Answer Correct ? | 2 Yes | 1 No |
proc sql;
create table dup_obs as (
select * from <lib>.<dsn>
group by <dup var>,<list of other vars>
having count(*)>1 )
quit;
Is This Answer Correct ? | 4 Yes | 3 No |
what is sas? is a package or tool? give me introduction about sas?
hi i date is 05sep2005; i want the oupput like 05sep2005:00:00:00 ; how it wil come?
explain the use of % includes a statement in sas? : Sas-administrator
what can you learn from the sas log when debugging? : Sas programming
Diff between proc sql merge and join?
i have multiple .csv files in a unix directory. every file is having variable names as header.even for empty file also. suppose take 3 files a.csv b.csv c.csv a.csv contains data as name;age,salary; raja;34;4000; ravi;33;5000; kumar;25;3000; b.csv contains data as name;age,salary; ajay;40;4500; and c.csv contains name;age,salary; (only headers) Now i want to import and append all these files in to a single dataset. i tried infile statement with *.csv to import all at a time. but i m not getting correct data. please help me . its urgent. thank you in advance
What is by-group processing?
what is AE onset date and what is RDS?
In SAS how to read the variable values having different formats. eg:mar99,mar1999 (in a single variable)
8 Answers GSK GlaxoSmithKline,
what is difference in window SAS & Unix SAS.....how do define working environment in both???
Have you ever used the SAS Debugger?
how does sas handle missing values in: assignment statements, functions, a merge, an update, sort order, formats, procs? : Sas programming