Tried that, but got the error message again:

 

 

. cem margins1 age if approach1 != . , tr(approach1)

 

Matching Summary:

-----------------

Number of strata: 28

Number of matched strata: 24

 

              1     2     3

      All   457  6352  2444

  Matched   457  6292  2427

Unmatched     0    60    17

 

            imbalance():  3258  <tmp>[1,1] found where void required

                 <istmt>:     -  function returned error

r(3258);

 

Dennis

 

From: Ariel Linden [mailto:ariel.linden@gmail.com]
Sent: Thursday, July 24, 2014 8:09 PM
To: Dennis Hanseman; cem@lists.gking.harvard.edu
Subject: Re: [cem] Error when using cem with >2 treatments

 

Your "if" statement needs to come before the comma

 

Ariel

 

 

From: Dennis Hanseman

Sent: Thursday, July 24, 2014 8:01 PM

Subject: [cem] Error when using cem with >2 treatments

 

I’m trying to use cem to do matching involving 3 treatments.  Prof. King (http://comments.gmane.org/gmane.comp.lang.r.matchit/393) indicated that this can be done.

 

When I tried it, I got an error message –

 

             imbalance():  3258  <tmp>[1,1] found where void required

                 <istmt>:     -  function returned error

 

There was a discussion on this site on July 24 of 2013 about a similar issue.  In that case, there were only 2 treatments but a treatment of “.”, along with “1” and “2”, showed up in the summary table.  The suggestion was to add “if indepvote != ." to the cem call.”
 
While I’m sure that there are no missing values of my treatment variable, I still tried to add the if clause to my cem call.  But it didn’t help.  I got another error:
 

. cem margins1 age, tr(approach1) if approach1 != .

option if not allowed

r(198);

 

Any ideas of how I can proceed?

 

Thanks.

 

Dennis Hanseman