Perl text library

November 30, 2009 at 4:49 am 1 comment

| Gabriel |

I found this very useful library of perl scripts for text cleaning. You can use them even if you can’t code perl yourself, for instance to transpose a dataset just download “” script to your ~/scripts directory and enter the shell command:
perl ~/scripts/ row_col.txt > col_row.txt

The transpose script is particularly useful to me as I’ve never gotten Excel’s transpose function to work and for some bizarre reason Stata’s “xpose” command only works with numeric variables. You can even use these scripts from directly in a do-file like so:

tempfile foo1
tempfile foo2
outsheet using `foo1'.txt
shell perl ~/scripts/ `foo1'.txt > `foo2'.txt
insheet using `foo2'.txt, clear

Entry filed under: Uncategorized. Tags: , , , .

some R baby steps R and TextMate

1 Comment

  • 1. T  |  November 30, 2009 at 8:34 am

    Nice one.

    My strategy typically is to encode all variables -tostring- and then use John Wallace’s -sxpose- (SSC). Destring selectively or create a global to store the variables which have type ‘numeric’.

The Culture Geeks

%d bloggers like this: