Hi, I recently used a loop in a command called putexcel. However, I would like to retrieve the value labels of one of my variables. Here is the variable in question:
and the code used:
However, nothing shows up as "expected" in column A when I look at my Excel sheet.
Are there any suggestions?
Thank you.
Michael
Code:
activites_actuelles Freq. Percent Cum. Autres activités 1,127 3.36 3.36 En emploi 18,291 54.52 57.88 En recherche d'emploi 65 0.19 58.07 En études 9,772 29.13 87.20 En études et en emploi 4,184 12.47 99.68 En études et en recherche 109 0.32 100.00 Total 33,548 100.00
Code:
putexcel set Figures.xlsx, sheet(Figure 2) modify // help putexcel putexcel A2 = "Variables" putexcel B2 = "Variables Names" * local row = 3 * * // loop for Bachelor_hes only forvalues i = 1/3 { local ba_hes Bachelor_hes foreach c of local ba_hes { svy,subpop(`c'`i'): prop activites_actuelles matrix A = r(table)' matrix B = e(_N_subp)' local varlabel1 : var label activites_actuelles local varlabel2 : var label Bachelor_hes`i' putexcel A`row' = "`varlabel1'" putexcel B`row' = matrix(A) putexcel K`row' = matrix(B) putexcel L`row' = "`varlabel2'" local row = `row' + rowsof(A) } }
Are there any suggestions?
Thank you.
Michael
Comment