I have a quick question to ask you. I basically want to extract the following table, by Bachelor (I have four bachelors and the matrix shown below is e(b): 1 x 22):
How can I extract with putexcel (or any other method more suitable for these cases please)?
I tried the following thing, but I have been struggling with Stata for well over an hour now:
The error given by Stata is :
Thank you so much in advance.
Code:
(running proportion on estimation sample)
Survey: Proportion estimation
Number of strata = 1 Number of obs = 12,135
Number of PSUs = 12,135 Population size = 20,798.814
Subpop. no. obs = 4,043
Subpop. size = 6,826.539
Design df = 12,134
--------------------------------------------------------------
| Linearized Logit
| Proportion std. err. [95% conf. interval]
-------------+------------------------------------------------
k_uebverl |
0 | .6167363 .0077506 .6014343 .6318104
1 | .1194908 .0050217 .1099926 .1296898
2 | .0940348 .0044806 .085612 .1031927
3 | .020252 .0021745 .0164013 .0249838
4 | .0111293 .0017 .0082458 .0150059
5 | .0099072 .001611 .0071999 .0136185
6 | .0143541 .0019683 .0109656 .0187697
7 | .0235214 .0024309 .0191992 .028788
8 | .0070225 .0013086 .0048717 .0101133
9 | .0067312 .0013486 .004543 .0099628
10 | .0066279 .0014243 .0043473 .010093
11 | .008272 .0016324 .0056154 .01217
12 | .0119176 .0019282 .008674 .0163541
13 | .0242573 .0024679 .0198625 .0295952
14 | .0115534 .0016617 .0087114 .0153083
15 | .0037225 .0009338 .0022758 .0060835
16 | .0017873 .0006813 .0008463 .0037706
17 | .000448 .0003167 .000112 .0017899
18 | .0028701 .0008847 .0015678 .0052485
19 | .0048346 .0011266 .0030605 .0076293
20 | .0005298 .0003805 .0001296 .0021632
21 | 0 (no observations)
--------------------------------------------------------------
I tried the following thing, but I have been struggling with Stata for well over an hour now:
Code:
putexcel set Partie1_MandatDG2022_mdg.xlsx, sheet(Figure 11) modify putexcel A2 = "Variables" putexcel B2 = "Variables Names" putexcel C2 = "Bachelor" putexcel D2 = "Variable Labels" putexcel E2 = "Matrices" putexcel F2 = "N" local row = 3 * * forvalues i = 0/3 { local ba_hes Bachelor_hes foreach c of local ba_hes { svy,subpop(`c'`i'): prop k_uebverl local m = matrix(e(b)) // help matrix functions - "el(s,i,j)" *You'll need to pull it out of r(table) local n = e(N_subpop) describe Bachelor_hes`i' local varlabel : var label Bachelor_hes`i' local varlabel2 : var label `var' putexcel A`row' = "`var'" putexcel B`row' = "`varlabel2'" putexcel C`row' = "Bachelor_hes`i'" putexcel D`row' = ("`varlabel'") putexcel E`row' = `m' putexcel F`row' = `n' local ++row } }
Code:
type mismatch r(109);
Code:
Comment