BookmarkSubscribeRSS Feed
teamlinerek
Fluorite | Level 6

I HAVE the following data:

DirectorIDCompanyIDAwardYearDegreeType
1928993623231998Undegrad
1798822623601998Undegrad
23841934677132003Other
17696494677132003Other
177773215194592002Undegrad
162788615194592003Undegrad
132394115194592004Undergrad
1839100602122008Grad
1706497602122008Undergrad

 

I want to count the number of unique rows (Matches) where a DirectorID matches with another DirectorID on ALL of the following criteria: (1) CompanyId, (2) within +/- one year of AwardYear, and (3) DegreeType.

 

The following output is what I WANT:

DirectorIDCompanyIDAwardYearDegreeTypeMatches
1928993623231998Undegrad0
1798822623601998Undegrad0
23841934677132003Other1
17696494677132003Other1
177773215194592002Undegrad1
162788615194592003Undegrad2
132394115194592004Undergrad1
1839100602122008Grad0
1706497602122008Undergrad0

 

What code could be used to create the "Matches" variable?

 

Thank you!!

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
  • 0 replies
  • 35 views
  • 0 likes
  • 1 in conversation