BookmarkSubscribeRSS Feed
nzrdufiu
Obsidian | Level 7
fyeargvkeymonthtrt1m
2010100410.826806
201010042-2.1148
2010100439.43563
201010044-1.77276
201010045-19.1961
201010046-15.0254
2010100470.358423
201010048-8.57143
20101004921.4844
201010041018.1136
201010041111.4338
201010041211.8485
201110041-2.47543
2011100421.86637
2011100431.57567
201110044-5.79004
2011100451.34409
2011100462.65252
2011100478.5825
201110048-19.5978
201110049-29.3345
201110041020.006
2011100411-8.37933
20111004124.98357
20121004110.9285
2012100424.05852
201210043-17.2336
201210044-14.9315
201210045-22.0065
20121004611.8672
2012100475.97181
2012100484.71499
20121004910.3495
2012100410-7.64312
20121004111.78926
201210041221.6146
2013100411.31156
201310042-6.79045
2013100434.66705
201310044-2.47417
20131004512.318
2013100469.57129
20131004710.6233
2013100483.5066
2013100498.92786
20131004107.40944
20131004116.62568
2013100412-10.2819
201410041-4.58765
2014100428.44278
201410043-10.2076
2014100440.096339
201410045-6.17761
20141004613.4156
201410047-2.12264
2014100482.97398
201410049-12.8159
201410041010.0414
2014100411-3.28302
20141004128.38861
2015100413.43772
2015100422.582
2015100434.42177
201510044-1.25407
201510045-2.31481
2015100467.88761
201510047-15.2024
201510048-9.72171
201510049-22.0304
201510041020.0053
20151004118.24152
20151004127.04397
201610041-19.7984
2016100421.3327
2016100439.30014
2016100443.63128
2016100451.5391
201610046-4.38345
2016100473.83462
2016100481.86258
20161004927.2653
20161004102.95338
201610041114.6721
2016100412-10.4093
201010131-14.4928
20101013219.3974
20101013315.2997
2010101349.43912
2010101353.25
201010136-10.2906
20101013771.7949
201010138-0.39277
201010139-0.07886
20101013100.157853
20101013110.236407
20101013120.235849
201010451-10.4787
20101045232.8035
201010453-0.87051
201010454-18.9901
2010104553.92954
201010456-11.6037
2010104574.42478
201010458-13.5593
2010104592.45098
201010451025.8373
20101045118.49176
2010104512-8.99533

 

I want to calculate cumulative quarterly return from this monthly return data. Please let me know which sas code I should use. For example, I want calculate 4 quarter return for a year. 

q1ret= (1+trt1m1)*(1+trt1m2)*(1+trt1m3)

Thank you.

3 REPLIES 3
Patrick
Opal | Level 21

@nzrdufiu

Please provide sample data via a SAS data step so we don't have to do this work for you. 

Members in this forum really like to help but you're expected to also demonstrate some own work. This doesn't need to be fully working code. Just show us what you've tried so far (may be some not yet working code) so we can better understand where you are at and take you from there.

I believe this is now already your 4th consecutive post where you've just posted data, stated the problem and then expect people to serve you. Please change this approach.

 

To give you a hint for your current question:

1. Use the mdy() function using your year and month variable and create a SAS date value

2. Use this SAS date value for grouping (i.e. by applying format YYQ.)

 

Reeza
Super User

Once you've made the changes suggested via @Patrick you can look into PROC EXPAND and/or TIMESERIES to do the conversion.

mkeintz
PROC Star

Do you want rolling quarterly returns, or calendar quarters?

--------------------------
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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1270 views
  • 0 likes
  • 4 in conversation