I am posting this to get some clarification on the time it takes Stata/MP 16.1 to run code. I was thinking of upgrading to Stata/MP 16.1 (2 Core) from Stata 15.1 SE, which involves a non-trivial amount of money but first obtained a trial version to test if it actually does make a difference. My computer has an i7-7Y75 Processor (1.3 GHz, 2 Core- 4 Thread), 16 GB RAM and a 256 GB SSD, and Windows 10.
I ran the code given at the end on both versions of Stata. The first time I ran it on Stata 16.1, it took ~78 seconds. However. when I reran the code, it took ~209 seconds and has not improved. I do not understand why it was so quick the first time and then started taking much longer. The same code takes ~211 second on Stata 15.1 SE.
About the code:
1) I have defined globals in a separate .do file, which I use to define paths to the datasets.
2) The datasets come from complete count US Census Data after deletion of observations and retaining relevant variables. I state the number of observations as in-line comments.
3) I loop over the following three steps three times (using the local census).
- I start with file "Census1940_Inctot.dta", rename certain variables and save as tempfile, which would allow a (M:1 merge in the next step)
- Then I load "Census_Merged_1910_1940_wide.dta", retain relevant variables and merge with the tempfile saved in the previous step.
- I save the dataset
I would appreciate any help. Thank you.
Omar Gondal
Code:
timer clear timer on 2 pause off local census "1930 1920 1910" foreach c of local census { use "${outputdir}/Census1940_Inctot.dta",clear // 110,095 observations
renvars state occ1950 race_ classwkr_ empstat_ inctot_avg_1940 , postdrop(5) renvars state occ1950 race classwkr empstat inctot_avg, postfix(_`c') isid stateicp_`c' occ1950_`c' race_`c' classwkr_`c' empstat_`c' tempfile Census1940_Inctot save `Census1940_Inctot'
use "${outputdir}/Census_Merged_1910_1940_wide", clear // 3,208,571 observations
keep *_`c' merge m:1 stateicp_`c' occ1950_`c' race_`c' classwkr_`c' empstat_`c' using `Census1940_Inctot', nogen sa "${outputdir}/Census`c'_Inc_Adjusted_wide.dta", replace
} timer off 2 timer list 2
0 Response to Stata/MP 16.1 Processing Speed
Post a Comment