I am trying to calculate the weighted frequency of unique households within the levels of a categorical variable. I know I need to use SERIAL for distinguishing unique household IDs. I have this code in SAS, but I can’t figure out how to incorporate HHWT.
select race, count(SERIAL) as unique_count
from (select distinct race, SERIAL from dataset)
group by race;
but Does anyone have tips or code for either R or SAS?