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?
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.