Hi all,
I have a character column, "PlayerTier1" contains "Classic" and "Emerald". I want how many of "Classic" in that column without resorting to filter out "Classic". Much like a CountIF function in excel.
Thank you all,
proc sql;
select count(PlayerTier1)
from have
where PlayerTier1='Classic';
quit;
proc sql;
select count(PlayerTier1)
from have
where PlayerTier1='Classic';
quit;
Thank you! But is there a Query Builder function I can use instead of resorting to proc sql?
@sdang wrote:
instead of resorting to proc sql?
btw, What this mean?
@mohamed_zaki wrote:
@sdang wrote:
instead of resorting to proc sql?
btw, What this mean?
Please see "to resort to something."
HI,
I'm sorry if my choice of word might be mis-led. I meant is there another way to get a summary table from Query Builder where a count column only counts Classic but others numeric columns sum by or count regardless of Classic? And using only Query Builder function, and not having to write codes in Proc SQL
Thanks
The answer is in @Haikuo post.
Probably worth marking this question answered at this point as well.
One last tip, the comparison is case sensitive, so determine if you need to account for that. If you do, use UPPER() or LOWER() to set them all to the same case.
Thank you!
Could be as straightforward as:
proc sql;
select sum(playtier1='classic') as classic_ct from have ;
quit;
Thank you!
Add new computed column -> advanced expression -> sum(playertier1='classic') -> enter the name of your new column -> done.
Query Builder writes SQL, so its the same as adding a filter within Query Builder.
For this type of summary its useful to determine why you want it, for display or in a table?
If display I would say a Summary Task would be more appropriate.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.