Hello!!
I have a question and I would appreciate your help. I am trying to count the amount of each vaccine at a clinic in a particular month. So this is the command that I am using:
by clinic vaccine_month vaccine_year, sort: gen bcg_count = _n if vaccine=1
by clinic vaccine_month vaccine_year, sort: egen bcg_no = max(bcg_count)
However, the if condition doesn't work. When vaccine 1 was not given it appears as a dot but somehow it still counts. For instance, it counts 1, ., 3 when it should be 1,.,2
Please let me know if you know what I am doing wrong
I have a question and I would appreciate your help. I am trying to count the amount of each vaccine at a clinic in a particular month. So this is the command that I am using:
by clinic vaccine_month vaccine_year, sort: gen bcg_count = _n if vaccine=1
by clinic vaccine_month vaccine_year, sort: egen bcg_no = max(bcg_count)
However, the if condition doesn't work. When vaccine 1 was not given it appears as a dot but somehow it still counts. For instance, it counts 1, ., 3 when it should be 1,.,2
Please let me know if you know what I am doing wrong
Comment