----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. For more info, type help dataex clear input byte pid double(t01 t11 d1) 1 -9 0 -9 2 -4 3 -7 3 -1.5 .5 -2 4 -2 1 -3 5 -4 .5 -4.5 6 -4 1 -5 7 -2.5 0 -2.5 8 -4 -.5 -3.5 9 -1.5 2 -3.5 10 -2.5 2.5 -5 end
Code:
collect clear table (command) (result), /// command(d1 = r(mu_1) /// pvalue = r(p) /// lci = (`r(mu_1)' - (invt(`r(df_t)',0.975)*`r(sd_1)'/sqrt(`r(N_1)'))) /// uci = (`r(mu_1)' + (invt(`r(df_t)',0.975)*`r(sd_1)'/sqrt(`r(N_1)'))) /// : ttest d1 = 0)
The first time I run it I get a syntax error, if I run it immediately afterwards it runs and if I then run it again I get a syntax error.
Code:
. do "C:\Users\marty\AppData\Local\Temp\V2MB94.tmp.do" . collect clear . table (command) (result), /// > command(d1 = r(mu_1) /// > pvalue = r(p) /// > lci = (`r(mu_1)' - (invt(`r(df_t)',0.975)*`r(sd_1)'/sqrt(`r(N_1)'))) /// > uci = (`r(mu_1)' + (invt(`r(df_t)',0.975)*`r(sd_1)'/sqrt(`r(N_1)'))) /// > : ttest d1 = 0) invalid syntax r(198); end of do-file r(198); . do "C:\Users\marty\AppData\Local\Temp\V2MB94.tmp.do" . collect clear . table (command) (result), /// > command(d1 = r(mu_1) /// > pvalue = r(p) /// > lci = (`r(mu_1)' - (invt(`r(df_t)',0.975)*`r(sd_1)'/sqrt(`r(N_1)'))) /// > uci = (`r(mu_1)' + (invt(`r(df_t)',0.975)*`r(sd_1)'/sqrt(`r(N_1)'))) /// > : ttest d1 = 0) ------------------------------------------------------- | d1 pvalue lci uci -------------+----------------------------------------- ttest d1 = 0 | -4.5 .0000963 -6.036122 -2.963878 ------------------------------------------------------- . . end of do-file . do "C:\Users\marty\AppData\Local\Temp\V2MB94.tmp.do" . collect clear . table (command) (result), /// > command(d1 = r(mu_1) /// > pvalue = r(p) /// > lci = (`r(mu_1)' - (invt(`r(df_t)',0.975)*`r(sd_1)'/sqrt(`r(N_1)'))) /// > uci = (`r(mu_1)' + (invt(`r(df_t)',0.975)*`r(sd_1)'/sqrt(`r(N_1)'))) /// > : ttest d1 = 0) invalid syntax r(198); end of do-file
Stata 17 BE, Current update level: 09 Aug 2021
Thank you.
Martyn
0 Response to table / collect - odd behaviour
Post a Comment