Merge generates 0 observations

Reply
Occasional Contributor
Posts: 18

Merge generates 0 observations

[ Edited ]

Hi,

 

It is quite weired but I indeed encountered this.

I tried to merge two datasets and I was pretty sure they are many same values for  all "by" variables. However, I got 0 oberservations when I specify "if a and b". Why does it happen?

____________________________________________________________________________________________________________

 

 

Hi all,

 

Thanks for replying. Now I am pretty sure the problem is from importing CSV data. Could anyone make a code to properly import the data into SAS? You might download "2012 Q1" from the following link:

 

https://www.sec.gov/opa/data/market-structure/market-structure-data-security-and-exchange.html

 

 

To be specific, variables "date" should be a yymmdd8. variable, "Security" and "ticker" should be characters, and the rest should be all numerics. I tried different ways, but all give me either missing values, or log ouput like the following when later:

 

ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
ERROR: There was a problem with the format so BEST. was used.
 

Respected Advisor
Posts: 4,779

Re: Merge generates 0 observations

@xyxu

Generic answer: Your condition in the subsetting IF statement is highly likely never TRUE.

 

Please post at a minimum your code so we have something to work with.

Super User
Posts: 23,951

Re: Merge generates 0 observations


xyxu wrote:

I was pretty sure they are many same values for  all "by" variables. 


They look the same but aren't for some reason, variable length or case (upper/lower) are examples. 

Super User
Posts: 2,495

Re: Merge generates 0 observations

Just checking: you use a MERGE statement and not a SET statement, right?

Super User
Posts: 10,530

Re: Merge generates 0 observations

Post:

- the code

- the log

- example data that illustrates your issue; do so in data steps generated with the macro from https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat..., so we can easily recreate your datasets with all attributes as they are.

 

Without that supplemental information, every suggestion will just be guesswork and mostly useless for you.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Ask a Question
Discussion stats
  • 4 replies
  • 178 views
  • 0 likes
  • 5 in conversation