turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- General Programming
- /
- How to work out those tables in this journal?

Topic Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-12-2015 08:40 AM

I am trying to work out the tables in this journal as I want to analysis the A-shares in China stock market from 2000 to 2014 ,

however, as I beginner, I am not familiar with the code of SAS.

What are those codes that I should input in order to work out those tables?

Moreover, I got the monthly returns of the each stocks and the monthly risk free rate.

Can someone please give me some instructions or methods in computing those tables?

Journal:

Dropbox - NARASIMHAN_et_al-1993-The_Journal_of_Finance.pdf

Monthly return

risk free rate

I appreciate your help!

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to JorLam

03-12-2015 08:48 AM

If you don't know SAS programming you need to learn, and the forum is not the right place for basic training.

Do have have assess to Enterprise Guide or SAS Studio? There you got standard tasks that you can use, and learn from the SAS code generated from them.

Data never sleeps

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to JorLam

03-13-2015 08:36 AM

I think that 's response comes from a sense that your post *sounds like *a homework assignment, and the participants in this forum are much more willing to help if you can share what you've already tried. Share details about the techniques, code, and your desired results.

For this particular question, I'd suggest that you begin with PROC IMPORT to read in the Excel files and convert them to data sets. You didn't say what software you have, but if you have SAS Enterprise Guide you can use the File->Import Data task. If using SAS University Edition, then you can learn from the community -- lots of links to FAQs and video tutorials.

From there -- after your data sets are in SAS -- you'll probably need to apply DATA step or SAS procedure techniques to apply the algorithms that are described in your journal article.

Chris

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to ChrisHemedinger

03-13-2015 08:56 AM

Dear Chris,

Honestly, this is my year project. I am really appreciate with those who can help me.I just encounter SAS within a month, i have tried my best to learn it as fast as possible, but i need to finish this year project before May.

I am afraid I cannot be able with this short time period, so I come here to ask for support. I have tried my best to finish Table1 already and here is my code for panel A in Table1.

proc import datafile = 'D:\monthlyretuen.xlsx'

DBMS = excel OUT = B;

run;

/* Step 1. Specifying Options */

%let J=6; /* Formation Period Length: J can be between 3 to 12 months */

%let K=6; /* Holding Period Length: K can be between 3 to 12 months */

%let begdate=01JAN2000;

%let enddate=01DEC2014;

run;

/* Step 2. Create Momentum Port. Measures Based on Past (J) Month Compounded Returns */

/* Make sure to keep stocks with available return info in the formation period */

proc printto log=junk;

proc sort data=B; by trdmnt;run;

proc sort data=B; by stkcd ;run;

proc expand data=B (keep=stkcd trdmnt mretnd) out=umd method=none;

by stkcd;

id trdmnt;

convert mretnd = cum_return / transformin=(+1) transformout=(MOVPROD &J log trimleft &J);

quit;

proc printto; run;

/* Formation of 10 Momentum Portfolios Every Month */

proc sort data=umd; by trdmnt; run;

proc rank data=umd out=umd group=10;

by trdmnt;

var cum_return;

ranks momr;

run;

/* Step 3. Assign Ranks to the Next 6 (K) Months After Portfolio Formation */

/* MOMR is the portfolio rank variable taking values between 1 and 10: */

/* 1 - the lowest momentum group: Losers */

/* 10 - the highest momentum group: Winners */

data umd;

set umd (drop=cum_return);

where momr>=0;

momr=momr+1;

HDATE1 = intnx("MONTH",trdmnt, 0,"B");

HDATE2 = intnx("MONTH",trdmnt,&K-1,"E");

label momr = "Momentum Portfolio";

label trdmnt = "Formation Date";

label HDATE1= "First Holding Date";

label HDATE2= "Last Holding Date";

rename trdmnt=form_date;

run;

proc sort data=umd nodupkey; by stkcd form_date; run;

/* Portfolio returns are average monthly returns rebalanced monthly */

proc sql;

create table umd2

as select distinct a.momr, a.form_date, a.stkcd, b.trdmnt, b.mretnd

from umd as a, B as b

where a.stkcd=b.stkcd

and a.HDATE1<=b.trdmnt<=a.HDATE2;

quit;

/* Step 4. Calculate Equally-Weighted Average Monthly Returns */

proc sort data=umd2 nodupkey; by trdmnt momr form_date stkcd; run;

/* Calculate Equally-Weighted returns across portfolio stocks */

/* Every date, each MOM group has J portfolios identified by formation date */

proc means data = umd2 noprint;

by trdmnt momr form_date;

var mretnd;

output out = umd3 mean=mretnd;

run;

/* Portfolio average monthly returns */

proc sort data=umd3; by trdmnt momr;

where year(trdmnt) >= year("&begdate"d);

run;

/* Create one return series per MOM group every month */

proc means data = umd3 noprint;

by trdmnt momr;

var mretnd;

output out = ewretdat mean= ewret std = ewretstd;

run;

proc sort data=ewretdat; by momr ; run;

Title "Jegadeesh and Titman (1993) Table 1: Returns of Relative Strength Portfolios";

Title2 "Portfolios based on &J month lagged return and held for &K months";

proc means data=ewretdat n mean t probt;

class momr;

var ewret;

run;

/* Step 5. Calculate Long-Short Portfolio Returns */

proc sort data=ewretdat; by trdmnt momr; run;

proc transpose data=ewretdat out=ewretdat2

(rename = (_1=LOSERS _2=PORT2 _3=PORT3 _4=PORT4 _5=PORT5

_6=PORT6 _7=PORT7 _8=PORT8 _9=PORT9 _10=WINNERS)

drop=_NAME_ _LABEL_);

by trdmnt;

id momr;

var ewret;

run;

/* Compute Long-Short Portfolio Cumulative Returns */

data ewretdat3;

set ewretdat2;

by trdmnt;

LONG_SHORT=WINNERS-LOSERS;

retain CUMRET_WINNERS CUMRET_LOSERS CUMRET_LONG_SHORT 0;

CUMRET_WINNERS = (CUMRET_WINNERS+1)*(WINNERS+1)-1;

CUMRET_LOSERS = (CUMRET_LOSERS +1)*(LOSERS +1)-1;

CUMRET_LONG_SHORT = (CUMRET_LONG_SHORT+1)*(LONG_SHORT+1)-1;

format WINNERS LOSERS LONG_SHORT PORT: CUMRET_: percentn12.1;

run;

proc means data=ewretdat3 n mean t probt;

var WINNERS LOSERS LONG_SHORT;

run;

/* Step 6. Plot Time Series of Portfolio Returns */

axis1 label=none;

symbol interpol =join w = 4;

proc gplot data = ewretdat3;

Title 'Time Series of Cumulative Momentum Portfolio Returns' ;

Title2 "Based on Jegadeesh and Titman (1993) Momentum Portfolios " ;

plot (CUMRET_WINNERS CUMRET_LOSERS)*trdmnt

/ overlay legend vaxis=axis1;

format trdmnt year.;

run; quit;

proc gplot data = ewretdat3;

Title 'Performance of Long/Short Momentum Strategy' ;

Title2 "Based on Jegadeesh and Titman (1993) Momentum Portfolios";

plot (CUMRET_LONG_SHORT)*trdmnt

/ overlay legend vaxis=axis1;

format trdmnt year.;

run; quit;

And now I am trying my best to compute Table 3 and 4. I almost finished Table 2, I just missing the beta and will able to get it within these days.