BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Jannic
Fluorite | Level 6

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. 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Jannic
Fluorite | Level 6

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

4 REPLIES 4
LinusH
Tourmaline | Level 20

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
Jannic
Fluorite | Level 6

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!

 

 

LinusH
Tourmaline | Level 20

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
Jannic
Fluorite | Level 6

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. 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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