BookmarkSubscribeRSS Feed
Songchan
Calcite | Level 5

Hello,

 

I matched two data sets using one condition (cusip number), now I'm going to match the lost matched observations with another condition (ticker number) I don't know how.

 

/*merge by cusip*/

proc sql;
create table cc as
select a.*,b.*
from aa02 as a, bb as b
where a.COL3=b.cusip and -5<=a.tr-b.datadate<370;
quit; 

 

 

aa02 (891201 observations) is one dataset, bb is another one, and there are only 140110 observations matched. 

4 REPLIES 4
PeterClemmensen
Tourmaline | Level 20

So you want to match the 891201-140110 non matched observations with observations from a third data set or?

 

If not, please be more specific.

Songchan
Calcite | Level 5

Hello,

I want to matched the rest observations (891201-140110) in aa02 data set with bb data set. Because what I want to do is to match the two data sets with CUISP number, Ticker number and Company Names, I just finished matching with CUISP number, and only 140110 out of 891201 are matched, that is not a good match.

PGStats
Opal | Level 21

"I want to do is to match the two data sets with CUISP number, Ticker number and Company Names"

 

that doesn't (shouldn't) require separate steps. It can all be done in one operation.

 

What makes you expect to get more matches?

PG
Songchan
Calcite | Level 5

Hello,

 

I have two data sets, one is monthly data, the other is annual data, I need to combine these two to ensure that each company has its both monthly and annual data. The first condition is CUSIP number, and the rest observations of monthly data match annual data under the second condition of same ticker number, there also should be some observations not matched,  so the last condition is company name.

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