How to Connect SAS with WRDS database (Example Codes!)
Academic researchers are required to work on WRDS database by connecting SAS online. This article explains how to connect SAS with WRDS database. Users can copy the code and use them in their research project.
1. Login to WRDS with SAS
If you want to work on WRDS database using SAS, you should follow the steps below:
Step 1: Define your local library where you will save your works:
option PS=58 LS=72 NODATE NONUMBER;
libname mywt 'C:\wikitekkee\Learning SAS\'; /*Define library where you will save your data */
Step 2: Login to WRDS via SAS:
To login to WRDS via SAS, follow the codes below:
/* Login to WRDS database */
%let wrds = wrds.wharton.upenn.edu 4016;
options comamid=TCP remote=WRDS;
signon username=_prompt_;
When you run the above code, you will see the Remote User Identification pop-up to enter your WRDS username and password. After typing the username and password, you are now logged in and ready to define the library.
2. Define Library from WRDS
After successful login, you need to define library of the data table from WRDS. For example:
/* define library */
rsubmit;
options source nocenter ls=72 ps=max;
libname compf '/wrds/comp/sasdata/naa'; /* COMPUSTAT FUNDA*/
libname crspm '/wrds/crsp/sasdata/a_stock'; /*crsp msf*/
Note:
- rsubmit: the codes written after rsubmit will be processed on WRDS’ server.
- Libname: The SAS statement
- compf: This is the library name we use in this example. You may use another name.
- ”/wrds/comp/sasdata/naa”: The library location on WRDS
Now you are ready to use these libraries.
3. Collect Customized Variables from WRDS with SAS
To collect data from WRDS, you MUST start your code with “rsubmit“. Then you can write your code. In this example, we use the compf (compustat Fundamental library and want to collect:
- gvkey: Company Key
- Fyear: Fiscal Year
- tic: Company Ticker Symbol
- sale: Sales
- ni: Net Income
- at: Total Assets
- act: Current Assets Total
- lct: Total current Liabilities
- lt: Total Liabilities
rsubmit;
data comp;
set compf.funda (keep=gvkey fyear tic sale ni at act lct lt);
where act is not missing and fyear>1980;
run;
Explanation of the above code:
- data: start the data statement
- set: the library from which you want to collect data/variable
- keep: We want to collect these variables, and we tell SAS to keep them
- where: we have told two conditions by where statement.
After running the above the code, you now have a table ‘comp’ on WRDS server. All operation you will perform must start with rsubmit, which indicates that you are working on the WRDS’ server.
The proc print command prints the first 10 observations:
4. Perform Basic Analysis on SAS-Connect
Now, you can perform your analysis. Here is an example:
rsubmit;
data comp;
set comp;
rename tic=ticker;
roi=ni/at;
run;
/* To print the new table with new variable "roi" */
rsubmit;
proc print data=comp (obs=10);
run;
The new table with new variable roi:
5. Download Data from WRDS to Your Computer
To download the data to your local library, you can use the following code:
rsubmit;
proc download data=comp
out=mywt.comp1;
run;
To work on the downloaded dataset from your local library, you are not required to use rsubmit.
data comp1;
set mywt.comp1;
run;
6. Export Data from SAS to STATA
You can also export your SAS dataset as STATA file, and the code is as follows:
proc export data=comp1
dbms=DTA
outfile="C:\wikitekkee\Learning SAS\comp1.dta"
replace;
run;
7. Connecting STATA with WRDS
To connect python with WRDS, you are required to follow the steps below: And there is a complete tutorial on WRDS and this one.
Once you connect STATA with WRDS, you can see only those tables in which your university or institution subscribes.
8. Connecting Python with WRDS
To connect python, R, MATLAB with WRDS, you can follow posts from WRDS.
WRDS data directory from Python, R, and MATLAB
Free Copy of The Essential Keto Cookbook – Limited Availability!
Hey there,
Don’t miss out on a FREE copy of The Essential Keto Cookbook, an Amazon Bestseller crafted by my friend Louise.
Act fast, as she’s giving away only a limited number for free (just cover shipping and handling).
Over 100 keto recipes
Burn fat effortlessly
Boost energy in a week
Get your free print copy here: https://bit.ly/47n3lyG
These keto-friendly recipes are 100% delicious, sugar-free, low-carb, gluten-free, grain-free, paleo, dairy-free, and legume-free.
Grab your cookbook before they run out!
https://bit.ly/47n3lyG
Best,
Keto team,
Hi wikitekkee.com,
The clock is ticking, and we wanted to give you a heads up – Quick Side Hustle is the key to making holiday debt vanish! Our 1-Click “No-Selling System” is your ticket to earning $208+ per day effortlessly(or drive a lot of traffic to your website), taking advantage of 57+ platforms valued at $142.08 billion dollars.
Don’t miss out on this golden opportunity. Secure your copy of Quick Side Hustle now before the price increases: https://www.vaulemedia.com/quicksidehustle . Act fast – only 8 out of 99 spots remain! As a special bonus, the first 99 action takers get instant access to the “Copy, Paste, And Profit” upgrade, worth $997. Users are reporting average earnings of $99/hour with this exclusive add-on.
Time is running out – act now and secure your spot!
Best regards,
Anne Maurer
UNSUBSCRIBE: https://www.vaulemedia.com/unsubscribe
591 Adamsville Road
Laredo, TX 78040
The average viewer watches a video for only 12 seconds…this new tech rewards viewers for watching your entire video. GAMIFYING your Youtube video is changing the way companies market.
As seen on CBS, NBC, FOX, and ABC.
Shoot me an email or skype msg below to see if you qualify for a free GAMIFICATION of your video.
Jordan
email: gamifyvideo@gmail.com
skype: live:.cid.d347be37995c0a8d
Claim your Reputation Video at no cost to you! Watch as we transform your exceptional 5-star reviews into captivating SEO content, propelling your visibility on Google’s front page. Claim your free video here: http://getyourfreereviewvideo.info
Join the Digital Revolution – for FREE!
Don’t miss out on this opportunity to upgrade your networking game while making a positive impact on the environment.
Get your FREE digital business cards today and make lasting connections effortlessly!
Follow this Secure Link To Transform Your Business @ https://popl.pxf.io/LXLGGa
#DigitalNetworking#SustainableBusiness#ProfessionalismRedefined#ModernNetworking#GoGreenWithDigitalCards
Did you know that a mere 1% of users bother to browse past the first page of search results? Don’t miss the chance to attract more traffic – get a complimentary website SEO audit today and boost your search engine ranking. Click here to fill out the form for Free SEO Website Audit: https://badgerdigitalmarketingsolutions.com/contact/
Learn How House Cleaning Business That Makes Over $2000 Every Week!
This Business Is For Anyone Who Wants To Make More Money &
Take Charge Of Their Future
Check The Link Below
https://bit.ly/3RgXi8s
SBS Gayo Daejeon (Korean: SBS 가요대전, broadly SBS Battle of the Bands) is an annual televised music festival that’s broadcast by the Seoul Broadcasting System at the tip of every year.
1988 however to the late 1870s,” Wittliff’s photographs are harking back to the nineteenth-century cowboy images by Erwin Smith and the western paintings of Frederic Remington and Charles M. Russell.
Hey,
If you are tired of spending money on useless IM products that never work…
And if you are not getting the results you want and need…
Read this email carefully…
Here’s why:
You need something that has BEEN PROVEN TO WORK…
Right now, you need one of the most powerful and innovative apps out there…
It’s called:
Amplify — the world’s first app that allows you to create automated AI Animated Review Videos that generate passive profits…
Every… single… day…
Without ever having to create any content or pay expensive video editors…
=> Click Here To Grab Amplify: https://www.enterprisetoday.info/amplify
Almost 2,000 users have already made life-changing earnings…
And now it’s YOUR turn…
These are the benefits of Amplify:
– Easy to use…
– Saturation proof…
– Make money in any niche…
– Generate $965.43 every 24 hours…
– Automated, passive profits…
– Unleash 20,000 Buyer Clicks with just 2 clicks…
AND MUCH MORE…
=> Click Here To Grab Amplify: https://www.enterprisetoday.info/amplify
This is going to knock your socks off…
You’ll be shocked by how powerful it is…
Talk soon,
Brant Buster
UNSUBSCRIBE: https://www.enterprisetoday.info/unsubscribe/?d=wikitekkee.com
Address: 4525 Cooks Mine Road
Maljamar, NM 88264
I am not sure where you’re getting your info, but good topic. I needs to spend some time learning more or understanding more. Thanks for excellent info I was looking for this information for my mission.
Oh my goodness! a tremendous article dude. Thank you Nonetheless I am experiencing challenge with ur rss . Don?t know why Unable to subscribe to it. Is there anybody getting an identical rss problem? Anyone who is aware of kindly respond. Thnkx
Grace Avery VanderWaal (born January 15, 2004) is an American singer-songwriter and actress.
Then, you can return and check out to know the opening line.