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?
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.