Dear Statalist ,

I have a data of food item that people eat. The data stored as numeric and labelled with their name. However, I want to create a new string variable of foodname, which receives label values of food. Basically, I would like to do the opposite of labmask command.
I have tried the following code that I found online but

Code:
quietly generate str foodname=""
quitely: labellist foodcode
forvalues row=1/`=_N'{
local foodcode_name=foodcode[`row']
local foodname: foodname`foodcode'
quietly replace foodname="`foodname'" in `row'
}
But Stata reported foodcode6 not allowed.

Can you please help?

Thank you so much.