I’m asking this because I’m not actually sure if this can actually be done.
The data is organised in the following format
ID | year | type |
---|---|---|
1 | 2023 | A |
1 | 2024 | B |
I’m trying to check these conditions under PROC SQL with CASE statement:
- If type = B and year = 2024 and type A’s year is <= 2024 then ‘TRUE’
- else ‘FALSE’
I’ve tried to a few case statements but my main struggle around is I’m not sure how I can check specifically the year of type A?
My less elegant solution is to store all Type = B and Year = 2024 in a separate table and cross check that with a separate table that stores Type A’s year.
In the sample data above, the conditional check should produce a TRUE value.
I would appreciate it someone would point me in the right direction or perhaps suggestions some functions.
Thank you.
SAS Newbie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.