Hello Statalist,
I would need to have a local named varlabel1 containing the label of the first variable in the dataset, a local varlabel2 containing the label ofthe second variable 2 and so on.
I am using the following code:
It works properly, but for the fact that it messes up with the first variable label, which is not recorded within double quotes in the local varlabels. Because of that,
consider "Make and Model" (the label of the first variable) as three different words.
Can anyone see why is that and how I could possibly fix the problem?
Many thanks in advance,
G.
I would need to have a local named varlabel1 containing the label of the first variable in the dataset, a local varlabel2 containing the label ofthe second variable 2 and so on.
I am using the following code:
Code:
sysuse auto, replace local varlabels ds foreach v in `r(varlist)'{ local varlabel : var l `v' local varlabels `varlabels' "`varlabel'" } local n_columns `c(k)' forval i=1/`n_columns' { local varlabel`i' `: word `i' of `varlabels'' } mac list
Code:
local varlabel`i' `: word `i' of `varlabels''
Can anyone see why is that and how I could possibly fix the problem?
Many thanks in advance,
G.
Comment