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.

 

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
  • 4 replies
  • 784 views
  • 1 like
  • 3 in conversation