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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 494 views
  • 0 likes
  • 3 in conversation