Dear All: Could you please tell me how to count a variable only if certain criteria is met in the proc sql syntax. For example, I want to count both people and Hispanic people. So I coded the following way, but the calculated p_count and chm_count is the same. Also, if I want to count rows in which certain variable called sex is F, could I go for count(sex = "F")? My old but stupid way is to use proc sql two time with the where statement and then join these two tables. That is not cool. Thanks! proc sql; create table ipums2 as select distinct year, statefip, county, count(pid) as p_count, count(race=4) as hs_count from ipums group by year, statefip, county order by year, statefip, county; quit;
... View more