How do you count the number of subjects in a big dataset? Each subject has serval records , is there a way to find the number of subjects in the dataset?
Take for instance the example data set SASHELP.SHOES. Imagine that the region column identifies your subjects. Then...
PROC SQL; SELECT COUNT(DISTINCT(Region))) AS COUNT_DISTINCT_of_Region FROM SASHELP.SHOES ; QUIT;
We find with this that there are 10 regions (or imagined subjects).
Related article: Your data ain't good looking, but it has a nice cardinality - The SAS Dummy
View solution in original post
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Latest Updates
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.