BookmarkSubscribeRSS Feed
art297
Opal | Level 21

Almost clear enough.  You want a case identified if there is EVER a gap of more than 1128 days AND/OR the last payment is more than 1128 days beyond WHEN?  Today's date?

Ksharp
Super User

OK. If I understand what you mean.

data have;
  informat dclrdt yymmdd8.;
  format dclrdt date9.;
  input permno  dclrdt;
  cards;
10006    19620803
10006    19620315
10006    19621102
10006    19630802
10006    19650406
10006    19680406
10007    19620803
10007    19620315
10007    19621102
10007    19630802
10007    19650406
10007    19680406
;
run;
proc sql;
create table want as
 select *,case when (select count(*) from have as b where b.dclrdt between intnx('qtr',a.dclrdt,-1,'s') and a.dclrdt-1 and b.PERMNO=a.PERMNO) gt 0 then 0 else 1 end as omission_1qtr ,
          case when (select count(*) from have as b where b.dclrdt between intnx('year',a.dclrdt,-1,'s') and a.dclrdt-1 and b.PERMNO=a.PERMNO) gt 0 then 0 else 1 end as omission_1year,
          case when (select count(*) from have as b where b.dclrdt between intnx('year',a.dclrdt,-2,'s') and a.dclrdt-1 and b.PERMNO=a.PERMNO) gt 0 then 0 else 1 end as omission_2year
  from have as a
   order by PERMNO,dclrdt ;
quit;

Ksharp

totomkos
Calcite | Level 5

Thank you for the help but i would like to let me explain you more analytically my problem. i have a sample with companies that distribute dividends either quartely, semiannualy or annualy. Frist of all i want to identify which of them pays quarterly , which semiannually and which pays annually. That is why i need to calculate the days between two consecutive distributions. If for example a firm distributes in every around 90 days, ti pays quarterly etc. (sas code needed)

The next step is to identify when a firm omit dividends. I base my criteria on previous literature in which a potential dividend omission is identified when a firm has not paid a dividend within 1 quarter, 6 months or 1 year from the previous payment if the firm pays quarterly, semi-annual or annual dividends respectively. I would like to help me about issuing sas code related to this. Additionally to the prvious statement related toomission identification, past papers allow for "late" payments and define a

3-year period to consist of 1128 days between payments. ( iwould be glad if can find the code for adding this to all the above)

Thank you in advance

Damien_Mather
Lapis Lazuli | Level 10

Hi Toto.

I have summarised your problem description and provided some code that may or may not be of more help to you as a template for what you need to do. To be fair to us SAS community helpers I am guessing that you could have given us all some more information about your problem. To be fair to you as a student I am guessing you are probably stressing out about your research task.  Am I right so far?

This is likely still not all of what you need but hopefully it will stimulate some more clarification and/or be close enough so you can figure out the rest.

Please let us all know how you get on and if you need more suggestions or help.

Cheers.

Damien

/*

I work on creating an omission sample with some restrictions in order to replicate a paper for my research.

The paper I am trying to replicate mentions that

"Using CRSP data on dividend payment history, a potential dividend omission is identified when a firm has

not paid a dividend within 1 quarter, 6 months or 1 year from the previous payment if the firm pays quarterly,

semi-annual or annual dividends respectively."

In this identification, we allow for "late" payments and define a 3-year period to consist of 1128 days

or approximately 31 days in a month.

For example if I had the following obseravtions and variables how do I add the restriction I mentioned above

(based on the restrction this is not an omission event as the last declaration is in the 3 -year period)

*/

data Have01(label='Sample data provided by student');

informat DclrDt ddmmyy10.;

format DclrDt date9.;

input PermNo DclrDt;

cards;

10006 3/8/1962

10006 15/3/1962

10006 2/11/1962

10006 2/8/1963

10006 6/4/1965

10006 6/6/1968

10007 4/5/1975

10007 15/8/1975

10007 2/11/1975

10007 4/1/1976

10007 6/4/1982

10007 7/7/1982

;

run;

/*

Let's say that we have the above sample , as you can see in company with permno 10007

there are quartely distributions until 4/1/1976, then the company stopped paying dividend until 6/4/1982.

This is by defintion an omission event (diff> 1128 days). For company 10006,

we have that it stops paying dividend on 6/6/1968, and it never distribute dividend again.

So if I have these cases in my sample I have to identify both of them and not only case 10006,

which is easy as I keep the last observation.

So my code for identifying my sample ought to have 2 cases.

a. final distribution if firm never pays dividend again ---no more data---keep the last distribution

b. previous to last observation -last observation >1128 then i have also an omission

and keep the previous to last abservation. ("last" does not mean that firm stop paying dividend for ever.

..for example a company had a long history of distributions, it stops for 5 years and then started again

-in this case i need the last observation before it stops paying.

I care about the diff in days between 2 declarations and which declaration is the last one

or the previous before the last declaration if the days between the last and the previous to last is over 1128 days

How can i find how often each company pays dividends (how many days between declarations)

and compare that number with the criteria of late payment (3-year period)?

*/

proc sort data=Have01;

by PermNo DclrDt;

run;

data Have02

(label='Sample data sorted by Firm ID and divident payment date, and time from previous dividend in QTRs  and days')

;

length Lag1DclrDt 8 LagDclrDays QTRs FlagLateDclr 3;

format Lag1DclrDt Date9.;

set Have01;

by PermNo DclrDt;

Lag1DclrDt=lag1(DclrDt);

if First.PermNo then Lag1DclrDt=.;

QTRs=intck('QTR',Lag1DclrDt,DclrDt);

LagDclrDays=DclrDt-Lag1DclrDt;

FlagLateDclr=(LagDclrDays gt 1128);

run;

proc summary data=Have02 nway;

class PermNo;

Var QTRs DclrDt;

output

  out=Have03

  (

   drop=_type_ _freq_

   label='Useful dividend stats by firm: Usual dividend interval in QTRs, first and last dividend date'

  )

  median(QTRs) = MedianDclrQtrs

  min(DclrDt) = FirstDcltDt

  max(DclrDt) = LastDclrDt

;

run;

proc sql;

create table Have04

  (label='Sample dividend data joined to useful firm stats: usual divident interval in QTRs, late dividend and  omission flags')

as

  select

   a.*,

   b.*,

   case

   when

    a.QTRs gt b.MedianDclrQTRs and

    a.FlagLateDclr ne 1

   then

    1

   else

    0

   end as FlagOmission

  from

   Have02 as a,

   Have03 as b

  where

   a.PermNo eq b.PermNo

;

quit;

run;

data Have05;

set Have04(where=(FlagLateDclr eq 1 or FlagOmission eq 1));

run;

Ksharp
Super User

OK.

You want to  firstly identify which of company pay quarterly or not, then identify a firm has not paid a dividend within 1 quarter  ? But I need some more sample data . The code below may help you a little bit .

data have;
  informat dclrdt yymmdd8.;
  format dclrdt date9.;
  input permno  dclrdt;
  cards;
10006    19620803
10006    19620315
10006    19621102
10006    19620402
10007    19620803
10007    19620315
10007    19621102
10007    19630802
10007    19650406
10007    19680406
;
run;
data have;
 set have;
 year=year(dclrdt);
 qtr=put(dclrdt,yyq.);
run;
proc sql;
create table omission_qtr as
 select *
  from have
   group by permno
    having count(distinct year)*4 ne count(distinct qtr);
quit;

Ksharp

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 19 replies
  • 2366 views
  • 0 likes
  • 4 in conversation