Matching a common field in 2 files

Frequent Contributor
Posts: 76

Matching a common field in 2 files

In file A, I have a column ID with many different rows of ID numbers (stored as char variables).

File B also has column ID & an extra Age column.

For all the ID in file A I want to find the ID with Age >12 in file B, how do I do so and extract them into a file?

Thank you

Respected Advisor
Posts: 4,736

Re: Matching a common field in 2 files

It's a bit difficult to give you a valid answer without you posting some representative sample data (2 data steps creating such data) and then telling us how the expected result should look like.

Here the recommendation of how to ask questions:

Below some untested "pseudo code" which might or might not be what you're after.
proc sql;

     create table want as

     select b.*

     from TableA a, TableB b

     where and b.age>12



Super User
Posts: 13,542

Re: Matching a common field in 2 files

May want

(select * from TableB where age>12) as b

instead as the where with the 'and' will limit the output of the TableA ids to only those as over age 12. Depends on how you meant 'all the ID in table A' to be interpretted.

Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation