excelcol provides a convenient way for Stata programmers to write loops and obtain Excel column name by it's index.
A summary of limits imposed by different electronic spreadsheets is available here.
findit excelcol
and follow the links to install the module.
There are two versions of the program: in Stata and in Mata. Both produce identical results. In fact Stata version simply calls Mata internally. Stata version of the command is implemented as an r-class command and saves the result into the macro column.
To call the mata version, write in Mata:
colname=ExcelColumn(#)
To call the Stata version, write in Stata:
excelcol #
local colname `r(column)'
The result in both cases is a string.
For example:
mata
colname=ExcelColumn(512)
colname
end
excelcol was written by Sergiy Radyakin, Economist, The World Bank.