Dear Statalist,
I am using the user-written "tuples" command to loop through all possible pairs of variables in a dataset and am encountering what seems to be a memory issue. The dataset is quite wide: 1,204 variables in all, although it only has 1,650 observations. I am using the tuples command to generate all possible pairs for 1,203 of these variables and store them in local macros. The 1,203 "variables of interest" are all 10 characters in length, meaning the tuples command should return macros of length 21 (the names of each variable in the pair plus a space separating them). In total, tuples should return 723,003 macros (1,203 choose 2).
I am well aware that this is quite a large number of macros for Stata to store, however, this older Statalist response indicates that Stata should not be limited the number of macros at issue here. That being said, I get the following error after executing the "tuples" command in the following code:
For some context, these 1,203 variables are price series, whereas the other variables hold the date. My goal is to use the macros stored by the tuples command in order to loop over variable pairs and calculate betas from rolling regressions of the price series on time and compare the estimated series of betas between the two products. Based on my Googling, it seems that this is a memory issue, but that is a little surprising to me. I am running Stata/MP 13.1 on a network machine with 370GB of disk space and 8 GB of RAM. Any assistance/advice with this issue would be appreciated.
-Best,
Michael G
I am using the user-written "tuples" command to loop through all possible pairs of variables in a dataset and am encountering what seems to be a memory issue. The dataset is quite wide: 1,204 variables in all, although it only has 1,650 observations. I am using the tuples command to generate all possible pairs for 1,203 of these variables and store them in local macros. The 1,203 "variables of interest" are all 10 characters in length, meaning the tuples command should return macros of length 21 (the names of each variable in the pair plus a space separating them). In total, tuples should return 723,003 macros (1,203 choose 2).
I am well aware that this is quite a large number of macros for Stata to store, however, this older Statalist response indicates that Stata should not be limited the number of macros at issue here. That being said, I get the following error after executing the "tuples" command in the following code:
Code:
* Bring all variables of interest into r(varlist) ds date, not * Now calculate all possible pairs of prices quietly tuples `r(varlist)', min(2) max(2) varlist #: 3900 unable to allocate real <tmp>[1203,1447209] tuples(): - function returned error <istmt>: - function returned error
For some context, these 1,203 variables are price series, whereas the other variables hold the date. My goal is to use the macros stored by the tuples command in order to loop over variable pairs and calculate betas from rolling regressions of the price series on time and compare the estimated series of betas between the two products. Based on my Googling, it seems that this is a memory issue, but that is a little surprising to me. I am running Stata/MP 13.1 on a network machine with 370GB of disk space and 8 GB of RAM. Any assistance/advice with this issue would be appreciated.
-Best,
Michael G
Comment