I am using Stata to deal with a large amount of data, but the process is taking a long time and we are looking for methods to improve it.
I am considering the following two methods, and I’d like to hear about your advice.
Method 1: Improving memory access
Because of the delay of processing performance due to lack of memory, I’ve been using 「compress」 when dealing with a large amount of data(tens of GB).
Do file is like following now
compress
reshape aaa,bbb,xxx,yyy,zzz
sort year code, stable
I’d like to know is it possible to improve processing speed and memory consumption by changing the order of this code?
eg(1):
sort year code, stable
compress
reshape aaa,bbb,xxx,yyy,zzz
eg(2):
reshape aaa,bbb,xxx,yyy,zzz
compress
sort year code, stable
Or may I also check if there is another method of coding can be better fit for this?
Method 2: Processing lots of commands at the same time instead of looping them
I’ve been using forvalues to process multiple commands.
Is it possible to process them at the same time instead of looping them?
(e.g.)
I would like to have process 4 commands(1,2,3,4) at the same time instead of process 4 commands in order(1->2->3->4).
Please enlight me if you have better ideas and highly appreciate your help to share us the detail of it.
I am considering the following two methods, and I’d like to hear about your advice.
Method 1: Improving memory access
Because of the delay of processing performance due to lack of memory, I’ve been using 「compress」 when dealing with a large amount of data(tens of GB).
Do file is like following now
compress
reshape aaa,bbb,xxx,yyy,zzz
sort year code, stable
I’d like to know is it possible to improve processing speed and memory consumption by changing the order of this code?
eg(1):
sort year code, stable
compress
reshape aaa,bbb,xxx,yyy,zzz
eg(2):
reshape aaa,bbb,xxx,yyy,zzz
compress
sort year code, stable
Or may I also check if there is another method of coding can be better fit for this?
Method 2: Processing lots of commands at the same time instead of looping them
I’ve been using forvalues to process multiple commands.
Is it possible to process them at the same time instead of looping them?
(e.g.)
I would like to have process 4 commands(1,2,3,4) at the same time instead of process 4 commands in order(1->2->3->4).
Please enlight me if you have better ideas and highly appreciate your help to share us the detail of it.
Comment