BookmarkSubscribeRSS Feed
tramn
Calcite | Level 5

Greetings,

 

I have a data set, in which companies pay dividends in different months in different years. I'd like to create a sequence of quarter dividend for 18 years.

 

I plan to group the dividend in different months into quarter dividend first, then create quarter dividend sequencing for different years next. Will there be any different and better way to do it? And would you kindly help me on the SAS procedures and programming please?

 

Thank you.

 

Best regards,

 

Tilda N.

3 REPLIES 3
Astounding
PROC Star
If you have a dividend date, you can get the first date of the quarter easily:

Q_begins = intnx('quarter', dividend_date, 0);
PGStats
Opal | Level 21

You could go for something like:

 

proc sql;
create table want as
select 
    intnx("qtr", divDate, 0) as divQtr format=yyq.,
    sum((divAmount) as qtrDivAmount
from have
group by calculated divQtr;
quit;

where divDate is a SAS date.

PG
mkeintz
PROC Star

@tramn 

 

I think you want to aggregate dividends for all companies, by quarter, correct?  If so, what are your date variables?  I.e., are they sas date values?  Or possibly year and month variables?  Could you show a sample of what your sas data set currently contains?

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 3 replies
  • 882 views
  • 0 likes
  • 4 in conversation