When using -vl rebuild- to rebuild vl macros (before saving a Stata dataset or after opening a Stata dataset that has been saved previously with vl macros defined) I receive the error message that a variable is not found.
I can't use -dataex- here to create a reproducible example, hence I simply describe what I did an show respective Stata output.
1) I did use -vl- commands to set and create system and user vl macros. Running -vl rebuild- shows the following:
2) After that I create several new variables. At the end I use -vl set [varlist]- to add the new variables to the vl system macros followed by -vl modify- and -vl move- to add these variables to vl user macros and to move them into the vl system macro vlcontinuous:
There is no error message and a subsequent -vl dir- shows the follwing result:
3) However, when running -vl build- now I receive the following error message:
although the variable truancy_ia exists:
Is there something I did not understand when using the -vl- commands? Is this a Stata bug?
I can't use -dataex- here to create a reproducible example, hence I simply describe what I did an show respective Stata output.
1) I did use -vl- commands to set and create system and user vl macros. Running -vl rebuild- shows the following:
Code:
. vl rebuild
Rebuilding vl macros ...
-------------------------------------------------------------------------------
| Macro's contents
|------------------------------------------------------------
Macro | # Vars Description
------------------+------------------------------------------------------------
System |
$vldummy | 204 0/1 variables
$vlcategorical | 138 categorical variables
$vlcontinuous | 91 continuous variables
$vluncertain | 0 perhaps continuous, perhaps categorical variables
$vlother | 0 all missing or constant variables
User |
$preval | 64 prevalence variables
$mresp | 102 multiple response variables
$binary | 33 binary variables (not preval or mresp)
$scale | 92 Likert scale variables (not multnom)
$multnom | 32 multinomial variables (not scale)
$count | 46 count variables
$contin | 9 (quasi) continuous variables
$meta | 24 metadata variables
$paradat | 31 paradata variables
$IS_natmod | 2 national module variables
-------------------------------------------------------------------------------
Code:
vl set truancy_ia truancy_ie vrobb_ia vrobb_ie vrobb_na vrobb_ne vassa_ia ///
vassa_ie vassa_na vassa_ne vthef_ia vthef_ie vthef_na vthef_ne ///
vhate_ia vhate_ie vhate_na vhate_ne vcyth_ia vcyth_ie vcyth_na ///
vcyth_ne vshin_ia vshin_ie vshin_na vshin_ne vshin_ta vshin_te ///
vcyhc_ia vcyhc_ie vcyhc_na vcyhc_ne vcyhc_ta vcyhc_te vphpu_ia ///
vphpu_ie vpama_ia vpama_ie clfrnum_a clfrnum_e clfrethn_a ///
clfrethn_e delpsln_a delpsln_e delpbun_a delpbun_e delpasn_a ///
delpasn_e delpsin_a delpsin_e delphan_a delphan_e graf_ia graf_ie ///
vand_ia vand_ie shop_ia shop_ie burg_ia burg_ie cart_ia cart_ie ///
exto_ia exto_ie weap_ia weap_ie gfig_ia gfig_ie aslt_ia aslt_ie ///
drud_ia drud_ie shin_ia shin_ie cyhc_ia cyhc_ie cyfr_ia cyfr_ie ///
hack_ia hack_ie hacksuc_ia hacksuc_ie hackid_ia hackid_ie, list
vl modify count = count + ///
(truancy_ia truancy_ie vrobb_ia vrobb_ie vrobb_na vrobb_ne vassa_ia ///
vassa_ie vassa_na vassa_ne vthef_ia vthef_ie vthef_na vthef_ne ///
vhate_ia vhate_ie vhate_na vhate_ne vcyth_ia vcyth_ie vcyth_na ///
vcyth_ne vshin_ia vshin_ie vshin_na vshin_ne vshin_ta vshin_te ///
vcyhc_ia vcyhc_ie vcyhc_na vcyhc_ne vcyhc_ta vcyhc_te vphpu_ia ///
vphpu_ie vpama_ia vpama_ie clfrnum_a clfrnum_e clfrethn_a ///
clfrethn_e delpsln_a delpsln_e delpbun_a delpbun_e delpasn_a ///
delpasn_e delpsin_a delpsin_e delphan_a delphan_e graf_ia graf_ie ///
vand_ia vand_ie shop_ia shop_ie burg_ia burg_ie cart_ia cart_ie ///
exto_ia exto_ie weap_ia weap_ie gfig_ia gfig_ie aslt_ia aslt_ie ///
drud_ia drud_ie shin_ia shin_ie cyhc_ia cyhc_ie cyfr_ia cyfr_ie ///
hack_ia hack_ie hacksuc_ia hacksuc_ie hackid_ia hackid_ie)
vl move ($count) vlcontinuous
Code:
. vl dir
-------------------------------------------------------------------------------
| Macro's contents
|------------------------------------------------------------
Macro | # Vars Description
------------------+------------------------------------------------------------
System |
$vldummy | 204 0/1 variables
$vlcategorical | 138 categorical variables
$vlcontinuous | 175 continuous variables
$vluncertain | 0 perhaps continuous, perhaps categorical variables
$vlother | 0 all missing or constant variables
User |
$preval | 64 prevalence variables
$mresp | 102 multiple response variables
$binary | 33 binary variables (not preval or mresp)
$scale | 92 Likert scale variables (not multnom)
$multnom | 32 multinomial variables (not scale)
$count | 130 count variables
$contin | 9 (quasi) continuous variables
$meta | 24 metadata variables
$paradat | 31 paradata variables
$IS_natmod | 2 national module variables
-------------------------------------------------------------------------------
Code:
. vl rebuild
Rebuilding vl macros ...
variable truancy_ia not found
Run vl rebuild to rebuild vl macros.
r(111);
Code:
. sum truancy_ia
Variable | Obs Mean Std. dev. Min Max
-------------+---------------------------------------------------------
truancy_ia | 395 6.103797 7.674988 0 43

Comment