how do we get duplicate observations in a separate dataset?

Answers were Sorted based on User's Feedback



how do we get duplicate observations in a separate dataset?..

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

how do we get duplicate observations in a separate dataset?..

Answer / mallikarjuna reddy.vanna

use DUPOUT option in proc sort statement.

Is This Answer Correct ?    12 Yes 1 No

how do we get duplicate observations in a separate dataset?..

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

how do we get duplicate observations in a separate dataset?..

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

how do we get duplicate observations in a separate dataset?..

Answer / rajaanku11

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

how do we get duplicate observations in a separate dataset?..

Answer / rajaanku11

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

Post New Answer

More SAS Interview Questions

what r the job openings SAS for fresher graduates !

0 Answers   TetraSoft, Wipro,


What is maximum number of rows and cols can be handled in SAS?

0 Answers   Signetsoft,


What are the statements that are executed only?

0 Answers  


describe the interaction table in sas di? : Sas-di

0 Answers  


Are you familiar with special input delimiters? How are they used?

4 Answers   Accenture,






How substr function works in sas?

0 Answers  


Name statements that are execution only?

7 Answers  


diff between nodup rec and ondup key???

3 Answers   AON, Sciformix,


How you are maintaining sas programmes in your company...any specific version control software you are using? If so, tell me the name?

0 Answers   Accenture,


How will you use the WHO Drug Dictionary for Reporting Clinical Trials?

0 Answers  


CHOOSE ANY ONE OF THE PROCEDURE FOLLOWING TO GENERATE THE REPORTS? HOW CAN YOU SAY IT IS BETTER THAN THE OTHER? AND DEFERENCIATE THESE TWO ? 1). REPORT PROCEDURE 2). TABULATE PROCEDURE

4 Answers   CybAge,


is it possible to generate sas datasets using proc print ???

1 Answers   GSK GlaxoSmithKline,


Categories