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.
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
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.
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.