You are not logged in. You can browse but not post. Login or Register by clicking 'Login or Register' at the top-right of this page. For more information on Statalist, see the FAQ.
However, it looks like you may not be able to create such a large matrix depending on your version of Stata. The help file I recommended above shows the following limitations:
10 < # < 11000 for Stata/MP and Stata/SE
and 10 < # < 800 for Stata/IC.
As long as the error message occurs as part of code written by yourself, you could think about transferring the matrix into Mata, do the calculations there and then transfer the result back to Stata. Mata is not bound by the limits in matsize.
Thank you all Sven-Kristjan actually I do not know how to use Mata - I mean, how to transfer the calculations there and then transfer them back into Stata...
The exact way of transferring the matrix or the calculations depend on your code. You did not show an example of the code which caused the error message. Hence, it is difficult to say how you could solve your problem with Mata.
local years = "2017 2018 2019 2020"
local countries = "AT BE BG CY CZ DE DK EE EL ES FI FR HR HU IE IT LT LU LV MT NL PL PT RO SE SI SK UK"
************************************************** *****************************
* Exporting the Atkinson Index table to Excel
************************************************** *****************************
foreach ctr in `countries' {
foreach yrs in `years' {
use "${path_log}\countryfile_atk_webstats_all_1", clear
save "${path_log}\countryfile_atk_webstats_all", emptyok replace
insheet using "${path_log}\countryfile_`ctr'_`yrs'.txt", tab clear
save "`ctr'_`yrs'", replace
use "${path_log}\countryfile_atk_webstats_all_1", clear
append using "`ctr'_`yrs'"
save "${path_log}\countryfile_atk_webstats_all_1", replace
erase "`ctr'_`yrs'.dta"
}
}
use "${path_log}\countryfile_atk_webstats_all_1", clear
save "${path_log}\countryfile_atk_webstats_all", replace
sort country year
* Exporting tables to Excel
use "${path_log}\countryfile_atk_webstats_all", clear
* Write header to the output file
cap file close webstatsfile
file open webstatsfile using "${outputfile2}", write text replace // "${outputfile2}" == "${path_projectfolder}\base_line_statistics_atk_2. csv"
file write webstatsfile "EUROMOD Web Statistics - Atkinson Index"
cap file close webstatsfile
save "${path_log}\temp_atk1.dta", replace
use "${path_log}\temp_atk1.dta", replace
* Decoding country var to a numeric var
gen c_numb = 0
replace c_numb = 1 if country == "AT"
replace c_numb = 2 if country == "BE"
replace c_numb = 3 if country == "DK"
replace c_numb = 4 if country == "FI"
replace c_numb = 5 if country == "FR"
replace c_numb = 6 if country == "DE"
replace c_numb = 7 if country == "EL"
replace c_numb = 8 if country == "IE"
replace c_numb = 9 if country == "IT"
replace c_numb = 10 if country == "LU"
replace c_numb = 11 if country == "NL"
replace c_numb = 12 if country == "PT"
replace c_numb = 13 if country == "ES"
replace c_numb = 14 if country == "SE"
replace c_numb = 15 if country == "UK"
replace c_numb = 16 if country == "EE"
replace c_numb = 17 if country == "HU"
replace c_numb = 18 if country == "PL"
replace c_numb = 19 if country == "SI"
replace c_numb = 20 if country == "BG"
replace c_numb = 21 if country == "CZ"
replace c_numb = 22 if country == "CY"
replace c_numb = 23 if country == "LV"
replace c_numb = 24 if country == "LT"
replace c_numb = 25 if country == "MT"
replace c_numb = 26 if country == "RO"
replace c_numb = 27 if country == "SK"
replace c_numb = 28 if country == "HR"
gen key=c_numb*10000+year
* Create the *Table 8 - Atkinson Index*
local tt_T8 = "Table 8: Effects of tax-benefit system on inequality (Atkinson index)"
mkmat c_numb year key dpi_atkinson05 dpi_atkinson1 dpi_atkinson15 orig_atkinson05 orig_atkinson1 orig_atkinson15 origpen_atkinson05 origpen_atkinson1 origpen_atkinson15, matrix (T8)
noi mat list T8
drop c_numb key
foreach outputmatrix in T8 { // T1 T2 T3 T4 T5 T6 T7 F3
file open webstatsfile using "${outputfile2}", write text append
file write webstatsfile _n
file close webstatsfile
noi esttab matrix(`outputmatrix') using base_line_statistics_atk, append title(`tt_`outputmatrix'')
}
If I understand your code correctly, then you are trying to export a matrix with more 40,000 rows to get some table. Whether this makes sense, is up to you.
You also do not show where exactly in the code the error message occurs, so I cannot help you solving this problem.
Comment