After using svmat command to save the beta coefficients of my regression as variables, I could not find a way to use them, for instance to generate new variables since they are only saved in one observation (see below). How can I make the beta coefficients saved for every observation? Thanks in advance.
stcox lnAGE lnBMI if Male==0,nolog nohr
failure _d: GeneralCVDA
analysis time _t: FTGeneralCVDA
id: ID_Cmod
Cox regression -- Breslow method for ties
No. of subjects = 6,355 Number of obs = 6,355
No. of failures = 568
Time at risk = 26344753
LR chi2(2) = 155.23
Log likelihood = -4856.5839 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
_t | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
lnAGE | 4.040776 .4100609 9.85 0.000 3.237071 4.844481
lnBMI | 1.508066 .1998089 7.55 0.000 1.116448 1.899685
------------------------------------------------------------------------------
. mat beta=e(b)
.
. svmat double beta, names(coef)
.
. tab coef1,m
coef1 | Freq. Percent Cum.
------------+-----------------------------------
4.040776 | 1 0.01 0.01
. | 11,600 99.99 100.00
------------+-----------------------------------
Total | 11,601 100.00
. gen AgeF=coef1 if Male==0
(11,600 missing values generated)
. tab AgeF,m
AgeF | Freq. Percent Cum.
------------+-----------------------------------
4.040776 | 1 0.01 0.01
. | 11,600 99.99 100.00
------------+-----------------------------------
Total | 11,601 100.00
stcox lnAGE lnBMI if Male==0,nolog nohr
failure _d: GeneralCVDA
analysis time _t: FTGeneralCVDA
id: ID_Cmod
Cox regression -- Breslow method for ties
No. of subjects = 6,355 Number of obs = 6,355
No. of failures = 568
Time at risk = 26344753
LR chi2(2) = 155.23
Log likelihood = -4856.5839 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
_t | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
lnAGE | 4.040776 .4100609 9.85 0.000 3.237071 4.844481
lnBMI | 1.508066 .1998089 7.55 0.000 1.116448 1.899685
------------------------------------------------------------------------------
. mat beta=e(b)
.
. svmat double beta, names(coef)
.
. tab coef1,m
coef1 | Freq. Percent Cum.
------------+-----------------------------------
4.040776 | 1 0.01 0.01
. | 11,600 99.99 100.00
------------+-----------------------------------
Total | 11,601 100.00
. gen AgeF=coef1 if Male==0
(11,600 missing values generated)
. tab AgeF,m
AgeF | Freq. Percent Cum.
------------+-----------------------------------
4.040776 | 1 0.01 0.01
. | 11,600 99.99 100.00
------------+-----------------------------------
Total | 11,601 100.00