Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# Re: st: Calculate product from two dta files

 From Zhangqunzi To "statalist@hsphsun2.harvard.edu" Subject Re: st: Calculate product from two dta files Date Wed, 7 Nov 2012 19:10:59 +0100

```Thanks a lot for ur kind advice, Nick.

> You asked this yesterday and no-one wanted to wrap their head around it.
>
> As I understand it you seek here not just one product price * share
> but several, so if each file is already too big for comfort, what
> structure precisely are  you seeking?
>
> There are some small things you can do:
>
> 1. Your dates are being held as values like 19700701. If that's a
> string or a large integer, convert to Stata daily dates, so that for
> example 19700701 if stored as a string or long could be stored as an
> int instead, a storage saving of 75% for that variable.
>
> 2. -compress- anyway. It will do no harm.
>
> There is really one solution here (other than Stata grinding exceedingly slow):
>
> It seems to me that you need more memory. I am guessing that this is
> the start of a project and you are doing early basic manipulations.
> You've not even started on the serious statistical analysis. You are
> going to be hitting this problem again and again. You need to talk to
>
> It's still true that you have an inadvisable data structure. I have
> asserted this twice before. If you had a long data structure, then the
> product price*share would just be one multiplication. That wouldn't
> solve your memory problem, however.
>
> Nick
>
>
> On Wed, Nov 7, 2012 at 9:31 AM, Zhangqunzi <zhangqunzi@googlemail.com> wrote:
>
>>> I have two dta files having the same structure :
>>>
>>> Dta1
>>> time firm price 1 2 3 4
>>> 19700701.   0.1.   12.  14.  3
>>> Dta2
>>> Time firm share 1 2 3 4
>>> 19700701.    10   20. 30. 40
>>>
>>> I want to get the product of price*share then generate a new dat file to store the result.
>>>
>>> The varlists from dta1,2 are not the same, eg p1 p3 p5. S1 S3 S5. Also the numbers are not continuous numbers.
>>>
>>> Also my cimputer's memory is not enough only 730mb, the two dtas are 600mb, if u calculate the product in one dta file it will exceed the memory limit.
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```