** 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
--------------------------------------
Related Posts with runby: requirements for group variable?
Testing significance of CAR in event studyDear Statalists, i have done an Event Study as described by Princeton DSS ( HTML Code: https://ds…
Output of 'ci proportions' depends on variable formatWhy does the result of 'ci proportions x' depend on the format of variable x? Very strange. Using ve…
Interpretation of interaction terms in logistic regressionI am not being able to interpret the interaction terms properly. can please anyone help? …
svysetHello, I am working with the Population Assessment of Tobacco and Health data. It is a panel survey…
Advice on extracting data from regression and exporting into a matrixDear all, I am trying to extract data from a pvar and mold it into a matrix. The output of the pvar…
Subscribe to:
Post Comments (Atom)
0 Response to runby: requirements for group variable?
Post a Comment