I am trying to generate new variable named, number of household in community who get credit with "NoHHCom_credit". The data set I have is survey data with 38 number of community in the country. In the data set, there is data about either the household get credit or not with variable name "hh_s14q01" and with 1=yes or 0=no, answers. the community dummy is represented by variable "saq07" and there is 38 communities.
The command I tried was
gen NoHHCom_credit = sum(hh_s14q01==1), if inrange(saq07==1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 ,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,3 2,33,34,35,36,52,53)
Please may you help me