Hi Joost, thanks for your suggestion! I was able to do the following, which is very simple but I think it works for my purpose. I post this to benefit other beginners like me and to spot mistakes if you see one.
%let wrds=
wrds.wharton.upenn.edu 4016;
options comamid=TCP remote=WRDS;
signon username=_prompt_;
libname myibes 'D:\...'; /*specify a library for yourself*/
/*Import the text file tickers, which has the list of tickers of the companies in an n rows x 2 columns format*/
/*first row has names of variables: ticker and year*/
proc import datafile="D:\...\tickers.txt"
out=myibes.tickers
dbms=tab replace;
getnames=yes;
run;
/*check the imported data*/
proc print data=tickers;
run;
/*Upload the tickers file onto the server*/
rsubmit;
proc upload data=myibes.tickers out=tickers;
endrsubmit;
/*See the content of the data file in IBES*/
rsubmit;
libname ibes '/wrds/ibes/sasdata';
proc contents data=ibes.STATSUM_EPSUS;
run;
endrsubmit;
/*create a table as matching data from IBES with the tickers and the years*/
rsubmit;
proc sql;
create table myTable as
select a.*, b.*, /*load all columns of the two files*/
year(a.STATPERS) as DataYear, /*so you see the year of the data*/
month(a.STATPERS) as DataMonth /*so you see the month of the data*/
from ibes.STATSUM_EPSUS a, tickers b
where a.OFTIC = b.ticker and year(a.STATPERS)=b.Year;
/*here we match OFTIC from ibes.STATSUM_EPSUS with
tickers from tickers*/
endrsubmit;
rsubmit;
proc print data=myTable (obs=10); /*print first 10 observations to check*/
run;
endrsubmit;
/*Download the data*/
libname myibes 'D:\...\IBES';
rsubmit;
proc download data=myTable
out=myibes.FinalData;
run;
endrsubmit;
My question is: what does your macro in
http://www.wrds.us/index.php/repository/view/35 do besides than downloading NUMEST from IBES? I think that you also clean the data by deleting missing records and deleting duplicates but you may explain it better than myself. I am pretty new to SAS so I can't read your code as fast but it's good to know what you do differently. Thanks a million!
DN