Hi,
I am having issues with the ability to collect named expressions.
If I try to collect an expression such as -1*_r_b, Stata only produces an error, "_r_b not found". Yet it can find _r_b alone. Various additions of () have not helped.
It seems that it should work: the help for -collect get- states that named expressions may include result identifiers such as _r_b.
Here is code to reproduce in a toy example.
I use version 17.0
Although I could use e(b) here instead of _r_b the pre-made 'result identifiers' such as _r_ci are very useful, and it would be great to be able to easily apply expressions to them using the -collect- named expression feature.
Perhaps I am missing something in the syntax, or maybe only the 'result identifiers' such as e(b) and not _r_b are available for expressions with calculations?
Thanks,
Scott
I am having issues with the ability to collect named expressions.
If I try to collect an expression such as -1*_r_b, Stata only produces an error, "_r_b not found". Yet it can find _r_b alone. Various additions of () have not helped.
It seems that it should work: the help for -collect get- states that named expressions may include result identifiers such as _r_b.
Here is code to reproduce in a toy example.
I use version 17.0
Code:
clear all //(I am forced to work on a remote server with no internet access, hence cannot easily use the various web data sets for example and will create a toy set first). set obs 1000 set seed 1000 gen y = runiform() > 0.33 gen x1 = rnormal() gen x2 = rnormal(2) cap collect drop c1 collect create c1 collect _r_b (copyb = _r_b) : logit y x1 x2 // this works: collect layout (colname)(result[_r_b copyb]) cap collect drop c2 collect create c2 collect _r_b (copyb = _r_b) (invb= -1*_r_b) : logit y x1 x2 //error: _r_b not found collect layout (colname)(result[_r_b copyb invb ])
Perhaps I am missing something in the syntax, or maybe only the 'result identifiers' such as e(b) and not _r_b are available for expressions with calculations?
Thanks,
Scott
Comment