Economics should be open

November 17, 2008

perl script for transposing Stata outreg2 output

Filed under: coding, Data Insights, Stata — Tags: , , — howardchong @ 10:38 pm

I’m using Stata’s outreg2 command and love it. But I run this look over 600 stocks. Excel doesn’t allow me to view 600 columns (Except in the newer version). ¬†So, I need to transpose the outreg2 file. It’s too wide. Too many columns.

My former post on someone else’s perl script (https://opensourceeconomics.wordpress.com/2008/10/02/perl-script-for-transposing-csv/)¬†actually doesn’t work correctly. I had to make two modifications, and the result is the perl script downloadable from here:

http://are.berkeley.edu/~chong/filesforblog/transpose_tsv_hc.pl

The two modifications are that 1) files are saved with tabs rather than commas. No big deal, I just changed the split operator and 2) the original script freaked out when there were blanks in the data. All blanks are ignored.

Advertisements

Create a free website or blog at WordPress.com.