Using PC-SAS with WRDS Sun Li Centre for Academic Computing lsun@smu.edu.sg 1
Outline Brief introduction to WRDS How to obtain a WRDS account How to access WRDS remotely Web-query SSH PC-SAS How to work with PC-SAS connection Where to get help 2
Brief introduction to WRDS WRDS: Wharton Research Data Services Single web based interface to a variety of databases and tools Easy, menu-driven queries Best used for straight-forward research needs Queries are run off site and can be received as e- mail attachments 3
Brief introduction to WRDS Log on WRDS with demo account: http://wrds.wharton.upenn.edu/demo/trydemo.shtml Log on WRDS with your WRDS account: http://wrds.wharton.upenn.edu/ 4
5
6
Obtain a WRDS account Eligibility for Access: SMU faculty, staff and students Types of Accounts Faculty standing faculty Administrative and staff administrator PhD student research students Visitor visiting faculty Research assistant research assistants Class standing faculty Temp account 7
Faculty: http://wrds-web.wharton.upenn.edu/wrds/ Step1: Click here to request for an account to access WRDS 8
Step2: Click to create your account 9
Step:3 Fill in your details and click on Submit Request button. Upon successful creation of your account you would be notified via email. Note: After Creation of Account, Kindly allow 1-2 days for Activation of your Account. 10
Students: Step 1: Go to library Databases. 11
Step 2: Find WRDS database and click to email us for a WRDS account. 12
How to Access WRDS Remotely How to access WRDS database: Web-query Secure Shell Client (SSH) PC-SAS Remote Access 13
Web-query Enter your WRDS Username and Password and click on Login 14
Example: CRSP IBM 2007 monthly stock data A 1. Start by selecting CRSP, via (A) or (B). B 15
2. Choose Monthly Stocks 16
3. Select variables and submit request 17
4. Download data 18
SSH Remote Access Windows examples: Secure Shell for Workstations, SecureCRT (Windows) Mac: DataComet Secure You may also initiate an ssh login from another UNIX or LINUX system For instructions: http://wrds.wharton.upenn.edu/support/docs/wrdsssh.shtml 19
20
Using the WRDS UNIX Server 1. Permanent storage: Each user has 750MB of permanent storage in home directory (e.g., home/smu/lsun) 2. Temporary disk space: About 2 terabytes of disk space is available for immediate processing and temporary storage. 1. SAS temp directories (/sastemp0 - /sastemp14): Files and directories older than 48 hours are automatically removed. Temporary work libraries created by SAS are automatically removed if the associated SAS process has ended. 2. System Temporary Directory (/tmp) DO NOT store files in /tmp. This directory is reserved for temporary files required by system commands and some UNIX programs. See details @ http://wrds.wharton.upenn.edu/support/docs/workspace.shtml 21
Access WRDS using PC-SAS Some of the PC-SAS characteristics: Windows software installed on your desktop/laptop. Standalone: your dataset in your PC. (For SAS installation, please contact CAC: cacstaff@smu.edu.sg ) Remote access to a data source on WRDS server 22
Advantage of using PC-SAS access: Powerful alternative to download huge data set from WRDS. Allow users to run their SAS programs in WRDS server using their PC-SAS in local PC. Avoid learning and remembering Unix syntax, and staying almost entirely in a windows PC environment to access and process data on the WRDS system. Allow users to make use of resources of the WRDS machine without having to work on Unix connection. Disadvantage: Auto log-off from processing work after about 2 hours. 23
How to Work with PC-SAS Connection SAS libraries, dataset lists and sample programs Work with PC-SAS connection Upload and download data procedures Manage data using PC-SAS Cancel a WRDS submission 24
Click here to view the currently-defined libraries Program Editor 25
Process in using PC-SAS connect: 1. Sign on the WRDS server 2. Submit jobs on the WRDS server 3. Return to the local SAS 4. Sign off the WRDS server 26
Step 1: Sign on: %let wrds=wrds.wharton.upenn.edu 4016; options comamid=tcp remote=wrds; signon username=_prompt_; 27
28
SAS libraries, dataset lists and samples Step 2: Click WRDS Datasets and sample Programs 29
30
Work with PC-SAS connect Remotely submit SAS code to WRDS system rsubmit; endrsubmit; Sign off the WRDS server The lines before and after it will be executed by the local PC SAS. All the codes between these commands will be submitted to the WRDS server. signoff; Sign-off command is not necessary, as after some time, the WRDS connection will be canceled. 31
the WORK library The WORK library is a temporary library residing on the WRDS system in which the dataset was created. If the dataset is created in the submit section, the WORK library will be stored on the Unix and can be accessed only by other submitted statements. SAS keeps the data in the WORK library for future use as long as the sign-off command has not been issued. 32
Access a WRDS database libname yourlibraryname /wrds/databasepath ; Eg.: libname ibes '/wrds/ibes/sasdata'; Access a local database libname yourlibraryname mydatabasefolder ; Eg.: libname mydata c:\documents\ibes'; Note: Critical SAS commands are highlighted to be blue. 33
Download procedure The download procedure allows the user to copy a remotely stored dataset to the local computer. PROC download data=remotedataset out=localdataset -- the local library reference must be declared BEFORE the rsubmit statement. -- the WRDS library reference must be declared AFTER the rsubmit statement. -- the proc statement must be written AFTER the rsubmit statement and the WRDS library reference declaration. 34
Upload procedure The upload procedure allows the user to copy a locally stored dataset to the WRDS machine, without leaving the SAS system. Example: 35
Manage data using PC-SAS Demo with examples using PROC MEANS & PROC SQL 36
Cancel a WRDS submission One way--click on the break icon in SAS window Another way--terminate via web Navigate to My WRDS page with your account Under Account, click on My PC SAS Connection You can monitor and terminate your PC SAS connection in this section 37
38
39
Where to get help Click here to view Support Information 40
WRDS Support email: wrds-support@wharton.upenn.edu WRDS SMU Representatives Celia Cheung (email: celiacheung@smu.edu.sg) Using SAS with WRDS Sun Li (email: lsun@smu.edu.sg) 41