BookmarkSubscribeRSS Feed
Tanvi99
Calcite | Level 5

Hi -

I am trying to do distinct counts. I have a detailed level dataset with other variables than that is shown below. My dataset is already filtered for the sub_channel. But I have different products..only one shown below. I would like to get the distinct counts based on the product. So if I have 100 different products, I will need to create 100 rows with distinct counts by product.

 

 

 

pty.png

2 REPLIES 2
novinosrin
Tourmaline | Level 20

Hi @Tanvi99   Can you post a better sample(that one can copy paste, test) and your expected output for the sample

 

A good sample should ideally be a comprehensive one that shows a few records of your different products .

 

Thank you

Astounding
PROC Star

What tools are you willing to consider as part of the solution?  SAS contains a variety of tools that can count.  The solution might be as easy as:

 

proc freq data=have;

tables product;

run;

 

If you need a data set holding the results, you can use a slight variation:

 

proc freq data=have;

tables product / out=want;

run;

 

Examine the data set WANT to see how close it comes to meeting your objective.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 2 replies
  • 590 views
  • 0 likes
  • 3 in conversation