BookmarkSubscribeRSS Feed
11 REPLIES 11
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Please review the guidance on posting new questions.  You have provided no information or even a question as far as I can tell.  Post test data in the form of a datastep, show what you want out from that, and explain any logic in between.

Reeza
Super User
How do you define the 'most popular product' or 'most purchased product'? Is it over a specific time frame? What does your data look like, are items in rows or columns? What do you want as output? Is this per store/region or product class or overall? Your question is not a question and unanswerable at this point in time.
ballardw
Super User

proc freq is one of the basic tools for counting.

 

with out examples of what your data might actually look like it is very hard to go much further than that.

SV75
Calcite | Level 5

The data is about the sales of product in different country with their product id and other details. So I need to find out the most popular product that is the product which is having great sale with respect to country.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Again:

Post test data in the form of a datastep, show what you want out from that, and explain any logic in between.

 

At a guess do something like:

proc sql;
  create table want as
  select  country,
          value
  from    (select country,sum(value) as value from have group by country)
  having value=max(value);
quit;

Or a proc means and output sum, then take top result.

Reeza
Super User

Vague question without data, equals vague answer without code or data. 

 

So sum the sales of each products in each country and rank them. PROC MEANS will sum them and PROC RANK will rank them to find the top products.


@SV75 wrote:

The data is about the sales of product in different country with their product id and other details. So I need to find out the most popular product that is the product which is having great sale with respect to country.


 

vamshirajd
Calcite | Level 5
how to know missing values
PaigeMiller
Diamond | Level 26

@vamshirajd you need to ask a complete question, providing all the relevant details.

--
Paige Miller
Kurt_Bremser
Super User

Note that hijacking another's 2-year-old thread is not a way for getting good answers. Please post your question in a new thread of your own, with a descriptive subject line, and pertinent details. Example data (posted as a data step with datalines in a code box) and expected outcome will be helpful.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 11 replies
  • 9429 views
  • 0 likes
  • 7 in conversation