我使用此代码通过 WRDS 云在 WRDS 服务器上使用 SAS,基于 Fama French(2015)计算运营盈利因子:
/* Create table of operating profitability */
proc sql;
create table op as
select gvkey, datadate, year(datadate) as year,
coalesce(revt, 0) as revenue,
coalesce(cogs, 0) as cost_of_goods_sold,
coalesce(xint, 0) as interest_expense,
coalesce(xsga, 0) as sg_and_a_expense,
coalesce(seq, ceq + pstk, at-lt) as stockholders_equity,
coalesce(mib, 0) as minority_interest,
(coalesce(revt, 0) - coalesce(cogs, 0) - coalesce(xint, 0) - coalesce(xsga, 0)) as operating_income,
(coalesce(seq, ceq + pstk, at-lt) + coalesce(mib, 0)) as be_plus_mi,
(coalesce(revt, 0) - coalesce(cogs, 0) - coalesce(xint, 0) - coalesce(xsga, 0)) / (coalesce(seq, ceq + pstk, at-lt) + coalesce(mib, 0)) as op_ratio
from comp.funda
where indfmt='INDL' and datafmt='STD' and popsrc='D' and consol='C' and curcd = 'USD'
and revt > 0
and (cogs > 0 or xsga > 0 or xint > 0)
and (seq > 0 or ceq + pstk > 0 or at > lt) > 0;
quit;
现在我需要根据以下类似于 FF (2015) 的说明计算用于 RMW 因子的 30 和 70 个百分点的营业利润率断点。 建筑:我们在每年 6 月底计算营业利润率断点。 t 年 6 月的 OP 是年收入减去销售成本、利息费用以及销售、一般和管理费用除以 t-1 中最后一个财政年度末的账面权益。 股票:t 年的断点使用我们拥有 t-1 的(正)账面权益数据、t-1 的非缺失收入数据以及以下至少一项的非缺失数据的所有纽约证券交易所股票:成本售出的商品、销售、一般和管理费用,或 t-1 的利息费用。我怎样才能继续代码来计算 30 和 70 个百分位断点?
如果有机会,我会在本周晚些时候尝试分享一些代码,展示我可能如何处理这个任务。