Eventus in Sas

493 views
Skip to first unread message

rich002

unread,
Aug 1, 2014, 9:34:14 PM8/1/14
to wrd...@googlegroups.com
Hi everyone.  I'm working with merger data and want the buy-and-hold abnormal returns for days -219 to -20 relative to announcement date for the target companies.  I'm trying to do this using Eventus, and I'm struggling with the code in Sas.  I have created the request txt file with the cusip and announcement date for each target.  I've been looking at example code, so below is the code I've come up with to extract each firm's buy and hold return.  It could be completely off.  I can't even get past the libname statement because it says that library doesn't exist, but the folder I'm referencing exists in my computer.  Any help is really appreciated!


%let wrds = wrds.wharton.upenn.edu 4016;
options comamid=TCP remote=WRDS;
signon username=_prompt_;
rsubmit;
/* Eventus code and SAS code to run on WRDS go below this line */


options fullstimer ps=42;
libname evdata 'Z:\mergersas\IN';
%let out_ds = evdata.results;
filename request './retained_forevent.txt';

Eventus;
Request autodate MinEstN = 50;
Windows (-219, -20);
Evtstudy BuyHold outsas=&out_ds package=dg;

Windows (-219,-20);
Extract type=MM vprefix=BAHwindow
insas = &out_ds outsas = evdata.bahreturns;
run;

endrsubmit;
signoff;

joost impink

unread,
Aug 1, 2014, 10:52:34 PM8/1/14
to wrd...@googlegroups.com
hi Rich,

I have not used Eventus scripts like this (so I don't have sample code), but the reason why you can't get past the libname statement is that you try to assign a local directory (i.e., on your computer) to a library while running in a 'rsubmit' code block. Code between 'rsubmit' and 'endrsubmit' is executed on the WRDS server, which has its own directory structure. 

In the rsubmit block you can upload files from your computer to your working directory on the wrds server (like this: proc upload data=yourlib.yourds out=work.ds). After that point, you can refer to your data on WRDS as work.ds. There is also a proc download. Another possibility is to use SSH (secure shell) and ftp to directly work on their server. WRDS has some documents on their website to get you started, see: http://wrds-web.wharton.upenn.edu/wrds/support/Accessing%20and%20Manipulating%20the%20Data/_002Unix%20Access/

Hope this helps,

Joost

rich002

unread,
Aug 3, 2014, 2:45:41 PM8/3/14
to wrd...@googlegroups.com
Thanks so much! I'll try this.

rich002

unread,
Aug 3, 2014, 3:23:30 PM8/3/14
to wrd...@googlegroups.com
Well I'm already back.  I definitely understand what you're saying about uploading files, so I can use proc upload to upload my request file.  What I'm having trouble with now is that in order to extract the buy and hold returns for each announcement, I have to use %let out_ds which apparently needs to link to a library.  Here are two examples that are similar to what I'm trying to do. 



Both establish this keep library for the %let out_ds, and one mentions putting it in unix home directory.  Now I'm bogged down because I don't know how to do this or honestly what a unix home directory is.  Any ideas?  Can't thank you enough for your help!



On Friday, August 1, 2014 7:52:34 PM UTC-7, joost impink wrote:

joost impink

unread,
Aug 3, 2014, 7:36:07 PM8/3/14
to wrd...@googlegroups.com
You're welcome :)

'Unix home directory' is where your personal files are, which are not accessible to other users (except admins). The typical directory is '/home/username', but on WRDS it is '/home/yourschool/username', where username is the username you use to log in; yourschool is an abbreviation for your university's name. 

The first link you give uses a path with a period (./eventus.txt); this look like a relative path, but I am not sure relative to which directory.

The second link is most straightforward (at least for me, it uses an absolute path):

libname keep '/home/school/username/eventus';

%let out_ds = keep.results;

The libname assigns 'keep' to a directory 'eventus' in the user's home directory. This eventus directory isn't there by default, so you need to create it. If that is not appealing at this point, you may want to use '/home/school/username' (whatever that is for you), without the eventus part (this should work without the need to create a directory).

If you don't know what your home directory is, you can run:
%let wrds = wrds.wharton.upenn.edu 4016;options comamid = TCP remote=WRDS;
signon username=_prompt_;

And look in the log; it will show a message like (in the beginning):
NOTE: AUTOEXEC processing beginning; file is /home/ufl/imp/autoexec.sas.

After the libname assignment to 'keep' you can upload/download/refer to datasets in 'keep'. 

best regards,

Joost 


Reply all
Reply to author
Forward
0 new messages