if the standard deviation of audfirm is 0 for a a company across years, the company has the same audfirm. Do you want to see if the company has the same audfirm between two consecutive years or across all years? To see by consecutive years, do
sort company year
gen x=1 if audifirm!=audifirm[_n-1] & company==company[_n-1]
replace x=0 if x==.