Monthly Archives: April 2011

Alternative dbWriteTable function for RPostgreSQL

The following function wraps around the dbWriteTable function from RPostgreSQL to provide a little more in terms of data types (e.g., keeps Dates as Dates) and fixing some gremlins with backslashes and double-quotes. It also gives the option to convert … Continue reading

Posted in Uncategorized | Tagged , , | Leave a comment

Perl script to load in CSV file from SAS file to MySQL

To run this, you would put (say) “dsi.csv.gz” and “dsi_schema.csv” in the working directory and then call “csv_to_mysql.pl dsi” to run the following:

Posted in Uncategorized | Leave a comment

Perl script to load in CSV file from SAS file to PostgreSQL

To run this, you would put (say) “dsi.csv.gz” and “dsi_schema.csv” in the working directory and then call “csv_to_pg.pl dsi” to run the following:

Posted in Uncategorized | Tagged , | 1 Comment

schema.sas

Here is the code for schema.sas

Posted in Uncategorized | Tagged | 1 Comment

Getting WRDS data into MySQL or PostgreSQL

In an earlier post, I talked about getting WRDS data into SQLite. One “advantage” of SQLite is that one doesn’t need to specify data types. But doing so is necessary with MySQL or PostgreSQL. Retaining the basic approach of my … Continue reading

Posted in Uncategorized | Tagged , , | Leave a comment

Installing RPostgreSQL with R 2.13 on a Mac

1. Download file from http://cran.r-project.org/web/packages/RPostgreSQL/index.html to ~/Downloads 2. From ~/Downloads, enter the following in the terminal: tar xvzf RPostgreSQL_0.1-7.tar.gz 3. Create a symbolic link to the pg_config file: sudo ln -s /Library/PostgreSQL/9.0/bin/pg_config /usr/local/bin 4. Edit the configure file in the … Continue reading

Posted in Uncategorized | Tagged , , | 2 Comments