Do you have a question?
Your sub-query doesn't know about columns created in the outer query, so you need to replicate the logic from the outer query in your sub-query.
I don't know your requirement, but I would guess you wnat to have a GROUP BY in your outer query, or what is your desired en result?
Do you want the most sold sku for every state, or just the overall highest order count and the state/sku combination associated with it?
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.