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

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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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