BookmarkSubscribeRSS Feed
Orange1984
Calcite | Level 5

I would like to merge two datasets and keep resultant dataset only appearing in dataset "temp1m". However, my log file indicates one more observation in the final dataset compared to "temp1m". Please see my log below. 

 

Do you have any idea why it happens and how to solve it? Thank you. 

 

1363  /* merge */

1364  data temp12;

1365     merge temp1m(in = b) temp2m(in = a) ;

1366     by stcode ctcode;

1367     if b;

1368  run;

 

NOTE: MERGE statement has more than one data set with repeats of BY values.

NOTE: There were 4559 observations read from the data set WORK.TEMP1M.

NOTE: There were 3142 observations read from the data set WORK.TEMP2M.

NOTE: The data set WORK.TEMP12 has 4560 observations and 223 variables.

NOTE: DATA statement used (Total process time):

      real time           0.06 seconds

      cpu time            0.06 seconds

2 REPLIES 2
Reeza
Super User

You have duplicates for your BY variables in one data set. 

Astounding
PROC Star

You have a mismatch somewhere ... a combination of STCODE + CTCODE that appears in one data set but not the other.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 769 views
  • 0 likes
  • 3 in conversation