I'm creating summary statistics using the table command, and I think there is a potential bug when using the * character to create a varlist of all variables.
The problem can be seen with this example:
The table command adds 3 tempvars to the output even though no tempvars exist in memory. The first tempvar is equal to _n, the second tempvar is a column of 1s, and the third tempvar is equal to the weight.
A look at table.ado points to collect table, and collect.ado shows that the variable equal to the weight comes from a tempvar `wvar'. I'm not for sure where the tempvar equal to _n or the tempvar equal to a column of 1s come from (perhaps the Mata function st_collect_table()).
My best guess is that the table command parses the varlist after the creation of the tempvars, which causes the bug. Any suggestions?
c(stata_version): 19
c(version): 19
table: *! version 6.0.0 01apr2021
collect: *! version 1.2.2 09jan2026
The problem can be seen with this example:
Code:
clear all sysuse auto, clear table (var) (result) [aw=mpg], stat(count *) stat(mean *) stat(sd *) stat(min *) stat(max *) // Includes 3 tempvars sum * [aw=mpg] // Does not include tempvars
A look at table.ado points to collect table, and collect.ado shows that the variable equal to the weight comes from a tempvar `wvar'. I'm not for sure where the tempvar equal to _n or the tempvar equal to a column of 1s come from (perhaps the Mata function st_collect_table()).
My best guess is that the table command parses the varlist after the creation of the tempvars, which causes the bug. Any suggestions?
c(stata_version): 19
c(version): 19
table: *! version 6.0.0 01apr2021
collect: *! version 1.2.2 09jan2026

Comment