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

Hello,

Everything works until I attempt to merge.  No error is given. fiveb has 0 observations.

 

%mysort4(nypop,nypop_s,A);
%mysort4(nonnycvotes,nonnycvotes_s,A);

data nypop_s; set nypop_s; run;
proc print data=nypop_s(firstobs= 1 obs= 10) label; run;

data nonnycvotes_s; set nonnycvotes_s (rename=( L=L2 M=M2 U=U2) );
run;
proc print data=nonnycvotes_s(firstobs= 1 obs= 10) label; run;

data fiveb;
merge nypop_s (in=makeup1) nonnycvotes_s (in=makeup2);
by A;
if makeup1 and makeup2;
run;

 

Thank you.

Mary A. Marion

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

@MaryA_Marion wrote:

Hello,

Everything works until I attempt to merge.  No error is given. fiveb has 0 observations.

 

%mysort4(nypop,nypop_s,A);
%mysort4(nonnycvotes,nonnycvotes_s,A);

data nypop_s; set nypop_s; run;
proc print data=nypop_s(firstobs= 1 obs= 10) label; run;

data nonnycvotes_s; set nonnycvotes_s (rename=( L=L2 M=M2 U=U2) );
run;
proc print data=nonnycvotes_s(firstobs= 1 obs= 10) label; run;

data fiveb;
merge nypop_s (in=makeup1) nonnycvotes_s (in=makeup2);
by A;
if makeup1 and makeup2;
run;

 

Thank you.

Mary A. Marion

 

 

 


With this code:

data fiveb;
merge nypop_s (in=makeup1) nonnycvotes_s (in=makeup2);
by A;
if makeup1 and makeup2;
run;

most likely there are NO matching values of the variable A in the two sets.

Consider that the first value in the nonnycvoters  has a value of "Albany" and the first in nypopulation is "Albany County" it is pretty obvious that the values do not match.

 

View solution in original post

4 REPLIES 4
Reeza
Super User
I can't download attachments, please post information directly into the forum or someone else will assist.
ballardw
Super User

@MaryA_Marion wrote:

Hello,

Everything works until I attempt to merge.  No error is given. fiveb has 0 observations.

 

%mysort4(nypop,nypop_s,A);
%mysort4(nonnycvotes,nonnycvotes_s,A);

data nypop_s; set nypop_s; run;
proc print data=nypop_s(firstobs= 1 obs= 10) label; run;

data nonnycvotes_s; set nonnycvotes_s (rename=( L=L2 M=M2 U=U2) );
run;
proc print data=nonnycvotes_s(firstobs= 1 obs= 10) label; run;

data fiveb;
merge nypop_s (in=makeup1) nonnycvotes_s (in=makeup2);
by A;
if makeup1 and makeup2;
run;

 

Thank you.

Mary A. Marion

 

 

 


With this code:

data fiveb;
merge nypop_s (in=makeup1) nonnycvotes_s (in=makeup2);
by A;
if makeup1 and makeup2;
run;

most likely there are NO matching values of the variable A in the two sets.

Consider that the first value in the nonnycvoters  has a value of "Albany" and the first in nypopulation is "Albany County" it is pretty obvious that the values do not match.

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 4 replies
  • 513 views
  • 1 like
  • 3 in conversation