Write and run SAS programs in your web browser

SAS Studio in WRDS - import data

Accepted Solution Solved
Reply
New Contributor
Posts: 3
Accepted Solution

SAS Studio in WRDS - import data

[ Edited ]

Dear All,

as a complete SAS newbie, I need to download & clean TRACE data from WRDS. Unfortunately I do not have access to SAS directly (as in having the software on my computer), but I can use SAS Studio in my webbrower thanks to WRDS. 

 

The cleaning procedure is already implemented in SAS, see the appended PDF. I only need to figure out how to access the TRACE data and put in memory such that the cleaning procedure works and then how to save the data. Using the web interface (I think) I have been able to access the dataset, using the following lines of code:

PROC SQL;
CREATE TABLE WORK.query AS
SELECT cusip_id , bond_sym_id , company_symbol , trd_exctn_dt , trd_exctn_tm , trd_rpt_dt , trd_rpt_tm , msg_seq_nb , trc_st , scrty_type_cd , wis_fl , cmsn_trd , entrd_vol_qt , rptd_pr , yld_sign_cd , yld_pt , asof_cd , days_to_sttl_ct , sale_cndtn_cd , sale_cndtn2_cd , rpt_side_cd , buy_cmsn_rt , buy_cpcty_cd , sell_cmsn_rt , sell_cpcty_cd , cntra_mp_id , agu_qsr_id , spcl_trd_fl , trdg_mkt_cd , dissem_fl , orig_msg_seq_nb , SUB_PRDCT , STLMNT_DT , TRD_MOD_3 , TRD_MOD_4 , LCKD_IN_IND , PR_TRD_DT FROM TRACE.TRACE_ENHANCED;
RUN;
QUIT;

PROC DATASETS NOLIST NODETAILS;
CONTENTS DATA=WORK.query OUT=WORK.details;
RUN;

PROC PRINT DATA=WORK.details;
RUN;

 

 

if I click "OUTPUT DATA" ribbon, it looks quite what I was looking for. The begining of the code of the cleaning procedure (the whole code is in the pdf) is the following:

 

* The name of the original Enhanced TRACE dataset
* supplied to the program;
%LET IN = traceIN;
* The name given to the cleaned Enhanced TRACE dataset;
%Let OUT = traceCLEAN;
* Path to your library containing the dataset;
* The cleaned dataset will be stored in this location;
Libname TRACE 'C:\Enhanced TRACE';

dm 'clear log';
dm 'clear output';

data temp_raw
temp_deleteI_NEW (keep = cusip_id entrd_vol_qt rptd_pr
trd_exctn_dt trd_exctn_tm rpt_side_cd cntra_mp_id
msg_seq_nb)
temp_deleteII_NEW (keep = cusip_id entrd_vol_qt rptd_pr
trd_exctn_dt trd_exctn_tm rpt_side_cd cntra_mp_id
orig_msg_seq_nb);
set trace.∈
where trd_rpt_dt ge '06Feb2012'd;
* Deletes observations without a cusip_id;
if cusip_id = '' then delete;
...

 

I am basically missing some lines in between. How to link "CONTENTS DATA" to "%LET IN ="

 

Unfortunately I completely lack SAS knowledge. Can someone point me to the right syntax here?

 

 

 

Thanks in advance,

Best!

 

 

 ----------------

EDIT: Thanks LinusH for pointing out that the PDF was missing in my original post. 

 

 

 

 

 


Accepted Solutions
Solution
‎02-02-2017 09:51 AM
New Contributor
Posts: 3

Re: SAS Studio in WRDS - import data

yea a friend figured it out. A quick look and he noted that

 

% LET IN =  query;

and deleting the Lib statement solves the problem and changing all the "trace" references to "query" solves the problem. 

View solution in original post


All Replies
Super User
Posts: 5,383

Re: SAS Studio in WRDS - import data

If you are to maintain/develop programs in SAS, you need SAS training.

I suggest you start with the free online SAS Programming course.

 

Just by looking into the pasted code, the DM statements won't probably work for you, since DM is an abbreviation for Display Manager, and refers to the fat SAS client, not SAS Studio web based interface.

 

PS

I can't see any PDF...

Data never sleeps
New Contributor
Posts: 3

Re: SAS Studio in WRDS - import data

Dear LinusH,

thanks for your reply. SAS would be a one time thing for me here, therefore I hoped I could avoid learning a completely new software package. Indeed I forgot the pdf. It is attached now. 

 

This dm statements I will not need. The rest of the code looks like rather basic commands that should/could be included in the Studio SAS. Could you help me bridge the gap between the data import and the cleaning code posted?

 

I appreciate it!

 

 

Super User
Posts: 5,383

Re: SAS Studio in WRDS - import data

Sorry, but I don't support others applications for free.

A general suggestion is try to run the code, and try to solve one problem at a time, until it works. 

Perhaps you have a co-worker that can help your out?

Data never sleeps
Solution
‎02-02-2017 09:51 AM
New Contributor
Posts: 3

Re: SAS Studio in WRDS - import data

yea a friend figured it out. A quick look and he noted that

 

% LET IN =  query;

and deleting the Lib statement solves the problem and changing all the "trace" references to "query" solves the problem. 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 394 views
  • 0 likes
  • 2 in conversation