[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Stata always breaks down when we use -nnmatch-

From   Austin Nichols <>
Subject   Re: st: Stata always breaks down when we use -nnmatch-
Date   Mon, 15 Feb 2010 10:13:25 -0500

Chris <>:
I have not looked into the limits or memory requirements of -nnmatch-
(on SSC), but there is no magic there for matching--you can do exact
matches on the 2 categorical variables via a -merge- (using the
treatment group as the master and the control group as the using
dataset) or use a -bysort- trick (sorting on the 2 categorical
variables and a treatment dummy) if all the data is together, then
find minimum distance matches by generating a distance variable based
on the 3 continuous ones (with distance given by abs of the difference
divided by sd).  Are you matching with or without replacement?  If you
provide an -input- statement that defines a simple dataset with 3
treatment cases and 20 control cases, you may get more specific advice
on how to proceed.  The advantage of using -nnmatch- is that it
computes effect estimates and SEs.

On the other hand, propensity score methods are nearly always much
easier.  You can run a logit of treatment on your 5 variables,
-predict p- and then reweight both groups using p
(, or use p
as your sole matching variable (or use -psmatch2- from SSC).

On Mon, Feb 15, 2010 at 9:06 AM, Stata Chris <> wrote:
> Dear all,
> we are trying to do some nearest-neighbor matching with the -nnmatch- command,
> with 3500 treated and 200,000 potential control units,
> currently with about 5 matching variables, thereof 3 continuous ones.
> Unfortunately the program always breaks down and generates this error message:
> "Insufficient memory to create more variables: Either increase memory
> or decrease m"
> We already left the number of matches at the default value of 1, so
> there is no scope there,
> and we set the memory to 12G, which also looks quite big.
> I found an older Statalist entry that points out the need to have at
> least 1GB RAM, which I'm sure we do have at least,
> but I don't know whether we can do anything beyond that?
> Or should we use another command that can achive the same results,
> while using less memory?
> Thank you very much for your suggestions and best regards,
> C
*   For searches and help try:

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