Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: comparing two .dta files


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: comparing two .dta files
Date   Tue, 12 Feb 2008 21:46:46 -0000

As Gabi later replied, this was the nub of the problem. 

Note that this gotcha is prominently documented. 

In the Stata 10 manuals, it is documented at [U] 18.3.4. 

Every once in a while, every serious Stata user really should just sit
down and read [U]. Naturally, you can skim and skip the bits you know
already, and the bits you think you know you don't need right now, but
you'll discover, or rediscover, many crucial details, like this one. 

Nick 
[email protected] 

Nick Winter

Without considering the larger logic of what you are doing, this line is

probably the/a problem:

    local mergeby`k'="`mergeby`k'' `var'`k'"

When you use the equal sign, you are telling Stata to evaluate the 
string that follows; that gets truncated to 244 characters (which is the

limit on the length of a string expression; see help limits).

You can simply assign, without evaluation, thusly:

    local mergeby`k' "`mergeby`k'' `var'`k'"

or even

    local mergeby`k' `mergeby`k'' `var'`k'

In both these cases, everything after the macro name is simply stored in

the macro, with a much larger limit on the length (165,200 in Stata/IC, 
or 1,081,511 in SE or MP; which is enough to allow a local to contain 
the complete list of variables in a dataset).

Gabi Huiber wrote:
> 
> I was recently given a do-file that insheets a bunch of files, works
> on them, then produces a .dta file 37 variables wide and several
> thousand observations long. Let's call this do-file the prototype
> version.

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index