Re: st: Conformability error in svytab

Arnold Levinson <levinsona@amc.org> wrote in about a problem with svytab.
> When using -- svytab var1 var2, subpop(varname) missing obs -- I get
> conformability error r(503). If I omit any one of the three options, I get
> results. Any ideas?
Then Lee Sieswerda <Lee.Sieswerda@tbdhu.com> points to the spot in the code
where the conformability error occurs.
> Interesting.... I also get a conformability error, but it depends on whether
> there is missing data in either of the two variables being used. The results
> are like this:
> missing + missing = conformability error
> missing + no missing = conformability error
> no missing + no missing = no conformability error
>
> A conformability error occurs when a program tries to combine two matrices
> that are of the same dimensions. A -trace- indicates that the conformability
> error occurs after this line:
>
> mat `J' = `J'*`Obs''
>
> Like you, I can generate this conformability error in some of my data with
> the following command:
> svytab q1 q2, subpop(subgrad9) missing obs
> IF AND ONLY IF:
> 1. one or both of q1 and q2 have some missing data, AND
> 2. the binary subpopulation variable (subgrad9 in this case) has a different
> set of missing values from q1 and q2
>
> I can get around the conformability error by making the missing value
> structure of the subpop variable the same as the variables I want to
> tabulate, like so:
>
> gen subgradtemp = subgrad9
> replace subgradtemp = . if q4==. | q5==.
>
> Now, running the command with the new subpop variable eliminates the
> conformability error, like so:
> svytab q5 q4, subpop(subgradtemp) missing obs
>
> I'm not sure if StataCorp could do anything to fix this. The code for svytab
> is pretty darn complicated. However, it might be worth mentioning a
> workaround like this one in the documentation of svytab.
Thanks to Lee, I am able to reproduce the problem. I believe I've found the
source of the problem and a solution. I hope to have this fixed and ready for
the next ado file update.
--Jeff
jpitblado@stata.com
*
* 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/