Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Export stata graph (data) to Excel?

Tags:

stata

Is there a simple way to export the "underlying" data of a Stata graph in order to reproduce that graph in MS Excel? Imagine you create a ROC curve using roctab y yhat, graph and you want to reproduce that graph in Excel.

like image 268
SPi Avatar asked Dec 02 '25 12:12

SPi


2 Answers

I assume that you do not have access to the actual raw data that was used to compile the .gph in the first place, and somehow want to back engineer the .gph file... then, eek, good luck!

If you do however have the access to the data originally used then with new command available in Stata 13, You can use the function putexcel command

A more detailed description of the putexcel command can be found here stata press releasse on exporting tables to excel

like image 166
D3L Avatar answered Dec 07 '25 03:12

D3L


The data in the .gph file are stored in the serset format between the and tags. There's no utility I know of that will parse the serset information, but it is very similar to Stata's dta file (v115 and below). I wrote up the basic file format information here. The Python library pandas has code for reading/writing dta files so with those you could probably create your own serset reader/writer.

like image 25
BeingQuisitive Avatar answered Dec 07 '25 05:12

BeingQuisitive



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!