Hello,

I have a dataset which is organised by id and quarter. I want to create a variable, based on a variable of the dataset, and it should look something like this:
egen var1=count(var) if var==1 & var==2, by(id quarter)
This type of code has worked for me previously, but now it is generating missing values.
Does anyone know what could be the problem?

Thank you