File Exchange

image thumbnail


version (301 KB) by Oleg Komarov
Matlab API to WRDS and SAS data sets


Updated 15 Feb 2017

From GitHub

View Version History

View license on GitHub

For a full description see
### Description
High level Matlab API that interacts with the Wharton Reasearch Data Services (WRDS) Unix server and its SAS data sets through SSH2.
### Description
First, run `wrds_install()` or add all relevant paths manually. You are ready to use `wrds()`.
### Requirements
* An account with WRDS of the type that admits SSH connections (PhD or above).
See WRDS's [account types]( for details.
* [Java enabled](

### Example

w = wrds('olegkoma','forgiveMeIfIDontTellYou');
w.cmd('echo "Hello World!"')

Download the [CRSPA/MSI dataset](


NOTE: check that your institution is subscribed to the CRSPA database through, or query


if it comes back empty, you probably do not have access to that database.

Cite As

Oleg Komarov (2021). okomarov/wrds (, GitHub. Retrieved .

Comments and Ratings (16)

Oleg Komarov

Hi Spy, have you read the description? The example is there. A nicely formatted description is available on github. All links are in the description.


Could you please provide an example for how to download TAQ data from WRDS using your code?

Mr Jensen

I hope you can help me :).
I have sent you the issue at github.

Oleg Komarov

Thanks for reporting on github, I took your issue from there.

Mr Jensen


I have an problem

Everything works fine until i try to run this command

// Command window //

>> getdatasetnames(wrds,libref)

Undefined function or variable 'passdlg'.

Error in wrds (line 50)
tmp = passdlg('ups');

What can be the problem?


Oleg Komarov

When I was developing it, I forgot that I manually created the tmp directory.
I updated the function to create the tmp directory at first run.

If you still find any problems or if you have suggestions or bug reports, you can also report them on

Haoxuan Zou

Finally I figure out why it didn't work, I hadn't establish the '~/tmp' directory.

Haoxuan Zou

No, it told me:

Adding Ganymed-ssh2 to the java path by running

Just added Ganymed-ssh2 to Matlab's dynamic java Classpath.
Retrieving SAS library names (libref).
Request submitted to WRDS servers.

w =

wrds with properties:

isVerbose: 1
isConnected: 1

Oleg Komarov

It seems as if you are not able to write to your ~/tmp/ directory.

If I SSH into WRDS, cd into tmp and ls -ld, I get:

wrds(~/tmp)% ls -ld
drwx------ ...

Also, when you login with w = wrds(...), does it retrieve the library names without errors?

Haoxuan Zou

Haoxuan Zou

My account type is: faculty, No Expiration Date
Sorry to bother you again and again

Oleg Komarov

What type of account do you have?

You can check on

Haoxuan Zou

When I ran:

Matlab told me:

etrieving dataset info for 'CRSPA.MSI'.
Request submitted to WRDS servers.

ans =

ERROR: Invalid file, /home/ubc/jchen/tmp/

Oleg Komarov

Please check if your institution is subscribed to the yearly update of the CRSP via

Oleg Komarov

Hi, if you call w.getDatasetInfo('CRSPA.MSI'), do you get a line that reads:

"Access Permission rw-r-----"

Haoxuan Zou

I run your program on macbook it tells me:
Error using ssh2_main (line 169)

Error Transferring File

Java exception occurred: Error during SCP transfer.
at ch.ethz.ssh2.SCPClient.get(
at ch.ethz.ssh2.SCPClient.get(
Caused by: Remote SCP error: scp: /home/ubc/jchen/tmp/
No such file or directory
at ch.ethz.ssh2.SCPClient.receiveFiles(
at ch.ethz.ssh2.SCPClient.get(
... 1 more

Error in ssh2 (line 84)
ssh2_struct = ssh2_main(ssh2_struct);

Error in scp (line 19)
ssh2_struct = ssh2(ssh2_struct);

Error in scp_get (line 50)
ssh2_struct = scp(ssh2_struct);

Error in wrds/SCPget (line 106)
obj.SSH2conn = scp_get(obj.SSH2conn, [rfname, rext], lpath, rpath);

Error in wrds/sas2csv (line 59)
wrds.SCPget(tmpzip, outfile);

Error in test (line 2)

Can you tell me why this error occur?

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Inspired by: SSH/SFTP/SCP For Matlab (v2)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!