MATLAB - SQL issues - FOR CRSP - Help is appreciated!
Posted: 05 March 2016 10:41 AM   [ Ignore ]
Newbie
Rank
Total Posts:  2
Joined  2016-03-05

Hi all

I’m new to the “world” of MATLAB downloading data from WRDS server when the SQL syntax need to be made.

I’m using MATLAB with WRDS at an Research Assistant account and have set up the connection from MATLAB to WRDS server with succes.

Can someone give me a real example how to write the SQL for the [..] questions below?
(Please use “CRSP” “stock day” “all companies” “one specific year defined” Thanks! smile )

Q.1

my_databases exec(WRDS,['select distinct memname from dictionary.columns where libname="dataset"']);
result fetch(my_databases);
result.data 


Q.2

my_variables exec(WRDS,['select name from dictionary.columns where libname="dataset" and memname="database"']);
result fetch(my_variables);
result.data 

Q.3
Gather All Data from A Specific Variable Value

query exec(WRDS,['select * from DATASET.DATABASE where varaible1 >= 100']);
result fetch(query);
result.data 

Q.4
Gather & Return Data of A Specific Variable

query exec(WRDS,['select variable1,variable2,variable3 from DATASET.DATABASE where variable1 >= 100']);
result fetch(query);
result.data 

 
Q.5
Date & Time Formatting

query exec(WRDS['select * from DATASET.DATABASE where date = "01jan2014"d']);
result fetch(query);
result.data 

It will be a huge help. THANKS!

 

Profile
 
 
Posted: 07 March 2016 09:21 AM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  901
Joined  2011-09-19

hi,

The tutorials contain several examples that have SQL; maybe an idea to start there? (Googling SQL tutorials will probably get you up to speed fast as well).

Hope this helps,

Joost

 Signature 

To reply/post new questions: Please use the group WRDS/SAS on Google Groups! http://groups.google.com/d/forum/wrdssas

Profile