Category Archives: Perl

Calculating fog using PostgreSQL and Perl

A measure of the complexity of text that has become popular in accounting research is “fog”; this equals (number of words per sentence + percentage of words that are complex) * 0.4. The following function run in PostgreSQL gives access … Continue reading

Posted in Perl, PostgreSQL | Tagged , , | 1 Comment

Perl script to pull SAS data from WRDS and put it into a local database

Usage: ./get_SAS_data.pl library datafile (for example, ./get_SAS_data.pl comp funda. This code doesn’t work with some files (e.g., CRSP daily stock file) due to the way that SAS PROC EXPORT handles special missing values (essentially converts “.A” to “A”, which PostgreSQL … Continue reading

Posted in Perl, PostgreSQL | Tagged | 3 Comments