I'm a SQL/SAS beginner. I wanna make an animals color report, which specifies quantity for each class black/brown, white/grey, gold/silver. I think it's not efficient to write the same code every time but i'm lost how to merge it into one:
select sum(cats), sum(dogs), sum(parrots)
from animals
where animals_color in (black, brown)
_______
select sum(cats), sum(dogs), sum(parrots)
from animals
where animals_color in (white, grey)
_______
select sum(cats), sum(dogs), sum(parrots)
from animals
where animals_color in (gold, silver)
I would like something like this but it doesn't return desired table:
select sum(cats), sum(dogs), sum(parrots)
from animals
where
(animals_color in (black, brown))
or
(animals_color in (white, grey))
or
(animals_color in (gold, silver))
I would very appreciate any tips or help! SAS's Data Step tips or alternative solution are welcome as well.