Dear all,
I try to import the table from Excel using the code below:
The first row in Excel contains column names consisting of the numbers like 100003 and so on.
However, Stata imports the table, taking these numbers labels and gives variable names like "A", "B", and so on.
When I try to rename them so that labels become names of variables, Stata cannot do that:
Could you please help me to either import the table so that integer of the first row were imported as variable names or to change labels to names.
Thanks a lot.
I try to import the table from Excel using the code below:
Code:
set maxvar 5700, permanently import excel using excess.xlsx , firstrow
However, Stata imports the table, taking these numbers labels and gives variable names like "A", "B", and so on.
When I try to rename them so that labels become names of variables, Stata cannot do that:
Code:
foreach v of varlist A B C { local x : variable label `v' *local q`v' =strtoname("`x'",0) - 1st attempt local q`v' =int(`x') - 2nd attempt ren `v' `q`v'' label variable `q`v'' "`v'" }
Thanks a lot.
Comment