3

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.

3
  • 1
    That's awful hard for me to imagine wanting to do that, but one way to try would be to learn about sersets. Alternatively, try editing the .gph file. My gut is that doing the calculations directly would usually be easier. Commented Nov 21, 2013 at 16:36
  • Thanks Nick. I thought that Stata must store the data to build the graph somewhere (x,y coordinates), so there might be a way to grab these datapoints.. Commented Nov 21, 2013 at 16:48
  • You were right. A .gph file is, naturally, not a graph, but a set of instructions on how to draw a graph. A serset is another take. [NB: not "STATA"!] Commented Nov 21, 2013 at 18:19

2 Answers 2

2

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

Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.