I am conducting survival data analysis using 'strate 'to calculate event rates. Since I have to calculate event rates for many groups, I would like to automatically export my strate results to an excel file. However, I cannot find a way for the putexcel command to read my strate output.
I have used to following code to calculate event rates:
stset persontime, failure(event==1)
stdescribe
strate, per(1000)
STATA returns the following output:
+-----------------------------------------+
| D Y Rate Lower Upper |
|-----------------------------------------|
| 346 7.4678 46.332 41.699 51.481 |
+-----------------------------------------+
When using a code for putexcel that was previously suggested (https://www.statalist.org/forums/for...tes-into-excel), the excel file remained empty:
putexcel set resultfile
stset persontime, failure(event==1)
strate, per(1000)
putexcel A1=(r(Rate)) B1=(r(Lower)) C1=(r(Upper))
I have seen tips telling to put my output in a matrix format, which I tried using the following code:
matrix list r(table)
However, STATA returned error code r(111): matrix r(table) not found
If anyone could help me identify where and/or how to fix my code, it would be much appreciated!
P.S. I saw a response recommending the use of the asdoc command. Although this worked fine, I prefer to export selected data to excel
I have used to following code to calculate event rates:
stset persontime, failure(event==1)
stdescribe
strate, per(1000)
STATA returns the following output:
+-----------------------------------------+
| D Y Rate Lower Upper |
|-----------------------------------------|
| 346 7.4678 46.332 41.699 51.481 |
+-----------------------------------------+
When using a code for putexcel that was previously suggested (https://www.statalist.org/forums/for...tes-into-excel), the excel file remained empty:
putexcel set resultfile
stset persontime, failure(event==1)
strate, per(1000)
putexcel A1=(r(Rate)) B1=(r(Lower)) C1=(r(Upper))
I have seen tips telling to put my output in a matrix format, which I tried using the following code:
matrix list r(table)
However, STATA returned error code r(111): matrix r(table) not found
If anyone could help me identify where and/or how to fix my code, it would be much appreciated!
P.S. I saw a response recommending the use of the asdoc command. Although this worked fine, I prefer to export selected data to excel
Comment