i am using Stata 14.
levelsof cropcode, local(code)
foreach x in local `code' { tabstat acd ack if cropcode==`x' & & state_s==1, stat(su) }
After running above command, i get error local not found