BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
kz_
Quartz | Level 8 kz_
Quartz | Level 8

What I want to do is filter one table by the values in another. Something like: 

 

data want; 

     set have; 

     where variable_i >= othertable[variable_i, column_name];

run; 

 

Variable_i exists in both tables and has 10 different values. The problem is that the filter value should be different for each of those values, and I don't want to hard code anything. 

 

Maybe it's because I'm too used to R, where this would be so easy. 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
Merge the two tables and then look up the value.
Load the second table into a temporary array and look up the values in the array.
Use SQL which is also a merge.

If you want specific examples you'll need to provide example data.

View solution in original post

3 REPLIES 3
Reeza
Super User
Merge the two tables and then look up the value.
Load the second table into a temporary array and look up the values in the array.
Use SQL which is also a merge.

If you want specific examples you'll need to provide example data.
kz_
Quartz | Level 8 kz_
Quartz | Level 8

Thank you. I was hoping there was a less annoying way, like creating a macrovariable vector. 

Reeza
Super User
Can't say without specifics
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
  • 3 replies
  • 2883 views
  • 1 like
  • 2 in conversation