how to display duplicated observations in a data using base
sas.
Answers were Sorted based on User's Feedback
two ways u can do ot.
1. proc sort with dupout option.
2. data step:
data nodups dups;
set sample;
by x;
if first. and last. then output nodups;
else output dups;
run;
proc print data=dups;
run;
Is This Answer Correct ? | 6 Yes | 0 No |
Answer / m.sivakumar
data dups;
input var1;
datalines;
1
2
3
4
4
3
5
6
;
run;
proc sort data=dups;
by var1;
run;
data dups1;
set dups;
by var1;
if not(first.var1 and last.var1) then output;
run;
proc print data=dups;
run;
proc print data=dups1;
run;
Is This Answer Correct ? | 4 Yes | 1 No |
Answer / pratik
By using Dopout option we can display duplicate observation.
Proc sort data=datasetname1 nodupkey dopout=datasetname2;
by varaible.
run;
proc print data=datasetname2;
run;
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / lakshmi
proc sort data=data1 out=data2 dupout=dup_data1 nodupkey;
by usubjid;
run;
the dataset dup_data1 has the duplicate observation.
Is This Answer Correct ? | 3 Yes | 2 No |
Answer / sheetal
If you are using SAS version 9 then use dupout option with
proc sort.
Is This Answer Correct ? | 2 Yes | 2 No |
Answer / prakash hullathi
use frequency procedure with single column
data dups;
input var1;
datalines;
1
2
3
4
4
3
5
6
;
run;
proc freq data=dups;
tables var1/norow nocol nopercent;
run;
The output will be like this
var1 frequency cumulative frequency
1 1 1
2 1 2
3 2 4
4 2 6
5 1 7
6 1 8
here the observations for the variable var1 3 and 4 are
appered 2 times and remaining appeared for 1 time by
seeing the frequency of corresponding variable and
observation
Is This Answer Correct ? | 2 Yes | 2 No |
Answer / pranitha patel
By using dupout option...
Proc sort data = X out = Xclean
Dupout = X dups nodupkey :
By variable :
Run:
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / manoj
Dupout Option
It is available on V9.1 onwards.
proc sort data=demo dupout=demo1 out=demo3 nodupkey;
by var1;
run;
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / dilip
proc sort data=x out=y;
by v;
data m;
set y;
by v;
if first.v and last.v then delete;
run;
this is for extracting duplicate observations
from a dataset
Is This Answer Correct ? | 1 Yes | 3 No |
How do handle working under pressure?
How would you code a merge that will write the matches of both to one data set, the non-matches from the left-most data set to a second data set, and the non-matches of the right-most data set to a third data set.
What is the Program Data Vector (PDV) and What are its functions?
what do you mean by data staging area? : Sas-di
Explain how merging helps to combine data sets.
In this question, I rename the numeric variable phone to numphone and then try use phone=put(numphone,comma16.) to store the numeric value numphone as a string value in phone. But I get a warning tha numphone already exists and in the data sat phone doesnt exist and numphone is set to missing. Why? data names_and_more; input Name $20. Phone : comma16. Height & $10. Mixed & $8.; Name = tranwrd(Name,' ',' '); rename phone = numphone; phone = put(numphone,comma16.); datalines; Roger Cody 9,087,821,234 5ft. 10in. 50 1/8 Thomas Jefferson 3,158,488,484 6ft. 1in. 23 1/2 Marco Polo 8,001,234,567 5Ft. 6in. 40 Brian Watson 5,183,551,766 5ft. 10in 89 3/4 Michael DeMarco 4,452,322,233 6ft. 76 1/3 ;
in which companies SAS openings are there? List of companies using SAS technology.
If you were told to create many records from one record, show how you would do this using array and with proc transpose?
Difference between informat and format?
Do you need to rearrange the order of the data for the report?
What is the good sas programming practices for processing large data sets?
What are the ways to do a “table lookup” in sas?