** This post references a previous forum discussion (https://www.statalist.org/forums/node/1484556) but is posted separately because it seems to deal with a sufficiently separate sub-issue. Please advise or link if the post should be continued under the previous thread.

I have been working with data using code that includes the very handy 'runby' module, which performs a program, looping over data by-groups. In my case, the code (written by Clyde Schechter and available here) performs matrix multiplication over a set of groups. The code works as expected for some of the data but there are many exceptions/errors. The error appears to result from some problem runby encounters when looping over certain group variables. For the below data, for example, the matrix multiplication operation is performed for three of the four groups: 1714081, 1714201 and 1714351 but *not* for one of the groups: 1714251, as indicated by the report appearing below the data.

The problem seems to be with the specific values of the group variable (i.e. observations 1714251). However, I examined the data type for these observations and it matches the other observations. I also examined the data structure for other variables associated with the 'errant' observations and the structure seems no different than other observations. However, the problem is not solved by simply changing the group id values to 001, 002, 003, 004. Whatever the problem, it is systematic and occurs for 1,096 of the 1,136 groups my data. I'd appreciate any help.

Thanks.

* Example generated by -dataex-. To install: ssc install dataex
clear
input long groupid byte(v1 v2 v3 v4 v5 v6 v7 v8 v9 v10)
1714081 0 0 0 1 0 0 1 0 0 0
1714081 1 1 1 1 1 1 1 0 1 0
1714081 0 0 0 0 0 0 0 0 0 0
1714201 1 1 1 1 0 0 1 0 1 1
1714201 0 0 0 0 0 0 0 0 0 0
1714201 0 0 0 0 0 0 0 0 0 0
1714201 1 1 1 1 1 1 1 0 0 1
1714201 1 1 1 1 1 1 1 0 1 1
1714201 1 1 1 1 1 1 1 0 1 1
1714251 0 0 1 1 1 0 1 0 1 0
1714251 1 1 1 1 0 1 1 0 0 1
1714251 1 1 1 1 1 0 1 0 1 1
1714251 1 1 1 1 0 0 1 0 1 0
1714251 1 1 1 1 1 0 1 0 0 0
1714251 1 1 1 1 1 1 1 0 0 1
1714251 0 0 0 1 0 0 0 0 0 0
1714251 0 0 0 0 0 0 1 0 0 0
1714251 1 0 1 1 1 1 1 0 0 1
1714251 1 1 1 1 1 0 1 0 1 0
1714251 1 1 1 1 1 1 1 0 1 0
1714351 0 1 1 0 0 0 0 0 0 0
1714351 0 0 0 0 0 0 0 0 0 0
1714351 1 1 1 1 1 0 1 0 0 1
1714351 1 1 1 1 0 0 0 0 0 0
1714351 1 0 0 1 0 0 0 0 0 1
1714351 1 1 1 1 1 0 1 0 0 1
1714351 0 1 0 1 0 0 0 0 1 0
1714351 1 1 1 1 1 0 1 1 0 1
1714351 0 1 1 0 0 0 1 0 0 0
1714351 1 1 1 1 0 0 1 0 1 1
end

[CODE]

. runby one_group, by(groupid)

--------------------------------------
Number of by-groups = 4
by-groups with errors = 1
by-groups with no data = 0
Observations processed = 30
Observations saved = 19
--------------------------------------