BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jonatan_velarde
Lapis Lazuli | Level 10

Good morning and happy hollydays:

 

well i have to go back into my research cause i noticed my self mistakes in my original data sets, due merging issues:

 

i have tried this:

 

data merged_data;
merge a2005 a2006 a2007a a2007b a2008 a2009 a2010a a2010b a2010c a2010c1 a2010c2 a2010c3 a2010c4 a2010c5 a2010c6 a2010c7 a2010c8 a2010c9 a2012a1 a2012a2 a2012a3 a2012a4 a2012a5 a2012a6 a2012a7 a2013a1 a2013a2 a2013a12 a2013a3 a2013a4 a2013a5 a2013a6 a2013a7 a2013a8 a2013a9 a2013a10 a2014 a2015;
by animal;
run;

 

but it stills get duplicating many data, this because exhaustively searched the duplicate in the excel and i didnt find this.

 

each data contains in one column called Animal, and the other(s) measurements.

 

Thank you very much for your help

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

To find duplicates across the files/years you can append them keeping only the key variables and the data source. 

 

 

data stacked;
set a2005-a2015 indsname=datasource; *may need to explicitly list records or you can find some shortcuts using colon;
source=datasource;
keep animal source;
run;

proc sort data=stacked;
by animal source;
run;

*You expect 1 per file, but are getting multiples so you can see which years have multiples;
data dups;
set stacked;
if not (first.source and last.source) then output;
run;

View solution in original post

2 REPLIES 2
Reeza
Super User

To find duplicates across the files/years you can append them keeping only the key variables and the data source. 

 

 

data stacked;
set a2005-a2015 indsname=datasource; *may need to explicitly list records or you can find some shortcuts using colon;
source=datasource;
keep animal source;
run;

proc sort data=stacked;
by animal source;
run;

*You expect 1 per file, but are getting multiples so you can see which years have multiples;
data dups;
set stacked;
if not (first.source and last.source) then output;
run;
Ksharp
Super User
proc sort data=sashelp.class out=duplicate nounikeys;
by age;
run;

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1280 views
  • 1 like
  • 3 in conversation