BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Agent1592
Pyrite | Level 9

Dear SAS Community:

I have panel data by firmid and date (quarters). I have in addition ni(net income) variable, return (ret) variable, cnt_ni which is the maximum number of quarters for each firm, and a simple count variable which counts the beginning and end of the quarters for each firm.

I would like to do a loop (rolling regression). Basically I am trying to set the minimum number of firm-quarter observations to 8. So if for firmid count is between 1 and 8 we have 1 regression, between 2 and 9 another one and so on. I know we have to use proc append but not sure how to do the rolling regression macro code.

PROC REG 
	DATA=test
	OUTEST=result RSQUARE NOPRINT;
	MODEL ret = ni;
	BY gvkey;
quit;
PROC APPEND BASE = result1 DATA = result;

 

data WORK.TEST;
  infile datalines dsd truncover;
  input firmid:$6. date:DATE9. ni:32. ret:32. cnt_ni:32. count:32.;
  format DATADATE DATE9.;
datalines4;
001000,31MAR1974,0.0665995976,0.5326963611,4,1
001000,31MAR1975,0.0415868673,0.1372751617,4,2
001000,31MAR1976,0.0790957374,0.3245687106,4,3
001000,31MAR1977,0.0443647682,0.1569266899,4,4
001001,31MAR1984,0.0099350549,-0.089042546,2,1
001001,31MAR1985,0.0218236173,0.3089041323,2,2
001003,31MAR1984,0.004827574,0.0144893592,1,1
001010,31MAR1974,0.0198241995,-0.072868616,7,1
001010,31MAR1975,0.0338809379,0.0169092395,7,2
001010,31MAR1977,0.026357479,0.0577793999,7,3
001010,31MAR1978,0.0247460739,-0.074640094,7,4
001010,31MAR1979,0.042475451,-0.02726128,7,5
001010,31MAR1980,0.0531934616,0.008752185,7,6
001010,31MAR1982,0.0361521597,-0.073388263,7,7
001011,31MAR1984,0.0125562663,-0.307994198,9,1
001011,31MAR1985,0.0331084121,0.7183596413,9,2
001011,31MAR1986,0.0072887533,0.1274002613,9,3
001011,31MAR1987,0.0065975754,-0.214663501,9,4
001011,31MAR1988,0.2380685444,0.1659101009,9,5
001011,31MAR1989,-0.006062443,-0.086984159,9,6
001011,31MAR1990,-0.06339814,-0.250317093,9,7
001011,31MAR1993,-0.023737663,0.1708571778,9,8
001011,31MAR1994,-0.0101768,0.2146591016,9,9
001019,31MAR1982,0.0719112584,0.1901397356,6,1
001019,31MAR1983,0.0580145036,0.0313360768,6,2
001019,31MAR1984,0.0227621841,-0.047551785,6,3
001019,31MAR1985,0.0216225277,-0.101864693,6,4
001019,31MAR1986,0.0221338945,0.3334400777,6,5
001019,31MAR1987,0.0149797088,-0.161109305,6,6
001020,31MAR1974,-0.019803546,-0.011904327,12,1
001020,31MAR1975,-1.283211783,1.2926711476,12,2
001020,31MAR1977,-0.163340051,0.4879558908,12,3
001020,31MAR1979,0.0279549159,-0.109228714,12,4
001020,31MAR1980,0.0512278481,-0.215027076,12,5
001020,31MAR1981,0.075783766,0.7372587782,12,6
001020,31MAR1982,0.0301958173,-0.209269385,12,7
001020,31MAR1983,0.0175104874,0.0091419375,12,8
001020,31MAR1984,0.0198688474,-0.059921752,12,9
001020,31MAR1985,0.0225972966,0.0531489587,12,10
001020,31MAR1986,0.0244611816,0.1818212542,12,11
001020,31MAR1987,0.0186582875,0.0567705826,12,12
001023,31MAR1984,0.0117067682,-0.253660282,4,1
001023,31MAR1985,0.0283010719,-0.129046683,4,2
001023,31MAR1986,0.0129968279,-0.143067865,4,3
001023,31MAR1987,0.019586406,0.0469880491,4,4
001034,31MAR1985,0.0351605193,0.2875440121,21,1
001034,31MAR1986,0.0149382745,0.0897110788,21,2
001034,31MAR1987,0.0139458584,-0.26166755,21,3
001034,31MAR1988,0.0240439697,0.4371398585,21,4
001034,31MAR1989,0.0181328461,-0.084153038,21,5
001034,31MAR1990,0.0171208385,0.2465843625,21,6
001034,31MAR1992,0.0085500295,-0.046869677,21,7
001034,31MAR1993,0.0070436275,-0.114086174,21,8
001034,31MAR1994,0.0117716089,0.190497974,21,9
001034,31MAR1995,0.0089751417,0.0385512522,21,10
001034,31MAR1996,0.0084407365,-0.158741892,21,11
001034,31MAR1997,0.0070999272,-0.061132038,21,12
001034,31MAR1998,0.0098002532,-0.118179653,21,13
001034,31MAR1999,0.0078055079,0.0693491002,21,14
001034,31MAR2000,0.0128585583,0.1459849388,21,15
001034,31MAR2001,0.0134930543,-0.14974307,21,16
001034,31MAR2002,-0.027024143,-0.463447952,21,17
001034,31MAR2003,0.0126373009,0.5558097004,21,18
001034,31MAR2004,-0.003004159,-0.048507768,21,19
001034,31MAR2005,-0.013081663,-0.254203545,21,20
001034,31MAR2006,0.004660247,-0.108773113,21,21
001036,31MAR1984,0.0041725127,-0.18442912,9,1
001036,31MAR1986,-0.007745477,0.110762778,9,2
001036,31MAR1987,-0.029669298,0.0181943333,9,3
001036,31MAR1989,0.0096336525,0.0368024609,9,4
001036,31MAR1990,0.0084882237,-0.077870296,9,5
001036,31MAR1991,0.0907357119,0.2283483425,9,6
001036,31MAR1993,0.0050308517,0.498389129,9,7
001036,31MAR1995,0.0123285376,-0.103926165,9,8
001036,31MAR2000,0.0093035563,-0.128989395,9,9
001039,31MAR1974,0.1233660877,0.2256237273,5,1
001039,31MAR1975,0.0949533645,0.0910929667,5,2
001039,31MAR1976,0.0865539122,0.2119969366,5,3
001039,31MAR1977,0.0682695646,0.0564982844,5,4
001039,31MAR1978,0.0754513676,0.3961006657,5,5
001040,31MAR1982,0.0165751704,-0.277851534,3,1
001040,31MAR1983,-0.007920031,-0.08916232,3,2
001040,31MAR1984,-0.00375779,-0.090439538,3,3
001045,31MAR1974,-0.042732408,0.2775407958,35,1
001045,31MAR1976,-0.034897253,-0.040294874,35,2
001045,31MAR1978,-0.022929931,-0.000830084,35,3
001045,31MAR1979,-0.017954165,-0.157874064,35,4
001045,31MAR1980,-0.21480862,-0.069184531,35,5
001045,31MAR1981,0.0124553782,0.6150094541,35,6
001045,31MAR1982,-0.131528383,0.3596825872,35,7
001045,31MAR1983,-0.030482316,-0.049490765,35,8
001045,31MAR1984,0.0345199593,-0.000258757,35,9
001045,31MAR1985,0.0344014037,0.0573054094,35,10
001045,31MAR1986,0.0056953951,0.2147262011,35,11
001045,31MAR1987,0.0063216044,-0.195480012,35,12
001045,31MAR1988,0.0329914569,0.1373763559,35,13
001045,31MAR1989,0.0320314606,0.0372866456,35,14
001045,31MAR1990,-0.005349817,0.1515149583,35,15
001045,31MAR1991,-0.064902261,0.0398757932,35,16
001045,31MAR1992,0.0016687526,0.0587493906,35,17
001045,31MAR1993,-0.004322625,-0.077880096,35,18
001045,31MAR1994,-0.001378333,-0.113313083,35,19
001045,31MAR1996,0.0276764151,0.142853597,35,20
001045,31MAR1999,0.0017744903,-0.047608184,35,21
001045,31MAR2000,0.0089605599,0.0058441005,35,22
001045,31MAR2001,-0.007216014,0.0253946289,35,23
001045,31MAR2002,-0.166907812,0.1811353839,35,24
001045,31MAR2003,-1.012437155,-0.663134262,35,25
001045,31MAR2004,-0.080325681,-0.037442629,35,26
001045,31MAR2005,-0.091802481,0.0013851271,35,27
001045,31MAR2006,-0.022648203,0.1530692954,35,28
001045,31MAR2007,0.0120574623,-0.008761835,35,29
001045,31MAR2009,-0.12599173,-0.663685585,35,30
001045,31MAR2010,-0.196407606,0.1181472525,35,31
001045,31MAR2011,-0.167848827,-0.216864556,35,32
001045,31MAR2014,0.0728156196,0.4221753747,35,33
001045,31MAR2015,0.0249160658,-0.028671836,35,34
001045,31MAR2016,0.0264622854,-0.036169656,35,35
001047,31MAR1982,-0.049866667,-0.261407789,1,1
001050,31MAR1994,-0.000161823,0.0550892758,20,1
001050,31MAR1999,0.0066658587,0.2070812387,20,2
001050,31MAR2001,-0.031355913,0.4390704961,20,3
001050,31MAR2002,-0.006209379,0.1397301132,20,4
001050,31MAR2003,-0.038384579,-0.017744084,20,5
001050,31MAR2004,-0.025553482,0.0303087536,20,6
001050,31MAR2005,-0.018384962,-0.001645273,20,7
001050,31MAR2006,-0.012831505,0.4417373686,20,8
001050,31MAR2007,0.0111045914,0.3709199468,20,9
001050,31MAR2008,-0.003541006,-0.15064581,20,10
001050,31MAR2009,0.0169351381,0.3878466696,20,11
001050,31MAR2010,0.0029588131,-0.150581733,20,12
001050,31MAR2011,0.0147408217,-0.071419168,20,13
001050,31MAR2012,0.025383609,0.2463082036,20,14
001050,31MAR2013,0.0130850609,0.1859967891,20,15
001050,31MAR2014,0.0073097925,0.0139136615,20,16
001050,31MAR2015,0.0004850692,-0.324493189,20,17
001050,31MAR2016,0.0119006378,-0.188584229,20,18
001050,31MAR2017,0.0000797381,-0.282684776,20,19
001050,31MAR2018,0.0324961473,-0.122880434,20,20
001065,31MAR1984,-0.018073056,-0.343261574,6,1
001065,31MAR1985,-0.02896186,0.5330668184,6,2
001065,31MAR1987,-0.026678506,0.4533936167,6,3
001065,31MAR1988,-0.046241723,0.267182886,6,4
001065,31MAR1989,-0.050941708,0.0296168742,6,5
001065,31MAR1990,-0.041861192,0.0984758348,6,6
001070,31MAR1974,-0.097944719,0.2648562717,4,1
001070,31MAR1975,0.1703488006,0.08858129,4,2
001070,31MAR1978,-0.020207905,0.0265213508,4,3
001070,31MAR1979,0.0229018314,0.326417502,4,4
001072,31MAR1974,0.0358560607,0.0134560633,15,1
001072,31MAR1976,0.0572189501,0.5914491489,15,2
001072,31MAR1977,0.0319121987,0.0741357758,15,3
001072,31MAR1978,0.0464532719,0.592061817,15,4
001072,31MAR1979,0.0379014988,0.2013772034,15,5
001072,31MAR1980,0.0229654742,-0.086899171,15,6
001072,31MAR1981,0.0081669043,0.1382939483,15,7
001072,31MAR1982,0.0090680667,0.4655018476,15,8
001072,31MAR1983,0.0055468992,0.0943214783,15,9
001072,31MAR1984,0.0160037758,-0.194515725,15,10
001072,31MAR1985,0.0010802282,-0.073402458,15,11
001072,31MAR1986,-0.01514784,-0.123708826,15,12
001072,31MAR1987,0.0249411765,0.3366279342,15,13
001072,31MAR1988,0.0288282272,-0.014838289,15,14
001072,31MAR1989,0.0284148696,-0.050330071,15,15
001073,31MAR1982,-0.00510949,0.6007029872,12,1
001073,31MAR1983,-0.002056226,0.5226942184,12,2
001073,31MAR1984,0.0021847394,0.3129916636,12,3
001073,31MAR1985,0.0044070523,0.1999522772,12,4
001073,31MAR1986,0.0088888889,0.1374106584,12,5
001073,31MAR1988,-0.119848277,-0.082223209,12,6
001073,31MAR1989,-0.207667284,3.6165993552,12,7
001073,31MAR1990,-0.128449188,0.4031268681,12,8
001073,31MAR1991,-1.334716869,0.0416287429,12,9
001073,31MAR1993,0.0085865794,-0.155137616,12,10
001073,31MAR1994,-0.011697128,-0.417767521,12,11
001073,31MAR1995,-0.105228789,-0.038769453,12,12
001074,31MAR1974,0.0432469935,0.3223594277,6,1
001074,31MAR1975,-0.013904705,-0.013137406,6,2
001074,31MAR1976,0.0049343554,-0.097210658,6,3
001074,31MAR1979,0.0197610331,0.2109592967,6,4
001074,31MAR1980,0.077294686,0.1365351694,6,5
001074,31MAR1981,0.0419024073,-0.072879051,6,6
001075,31MAR1974,0.0262135172,0.0406609417,36,1
001075,31MAR1975,0.0528055556,-0.065632525,36,2
001075,31MAR1977,0.0347447983,0.0419719849,36,3
001075,31MAR1978,0.0341130432,0.0103854887,36,4
001075,31MAR1979,0.025870303,-0.061764528,36,5
001075,31MAR1980,0.0364321126,-0.037523162,36,6
001075,31MAR1981,0.0308702131,-0.056056403,36,7
001075,31MAR1982,0.0396651818,0.1845629591,36,8
001075,31MAR1983,0.033316129,-0.093508249,36,9
001075,31MAR1984,0.0397083037,-0.002078712,36,10
001075,31MAR1985,0.0382540757,-0.028722367,36,11
001075,31MAR1986,0.029077038,-0.011650098,36,12
001075,31MAR1989,0.0359154347,-0.135368628,36,13
001075,31MAR1990,0.0217100977,0.3157038948,36,14
001075,31MAR1991,0.0154743131,-0.075898544,36,15
001075,31MAR1992,0.0106409666,0.0258529721,36,16
001075,31MAR1993,0.0199124316,0.0153694429,36,17
001075,31MAR1994,0.0148912741,-0.062121371,36,18
;;;;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Well, I guess the answer depends on what you mean by "simple". I'm going to state my opinion that this is not "simple".

 

Nevertheless, there are examples out there on the Internet, such as this one (no macros required)

http://pages.stern.nyu.edu/~adesouza/sasfinphd/index/node25.html

 

If you really want a macro, then your favorite internet search engine will find rolling regression macros for you to use.

--
Paige Miller

View solution in original post

2 REPLIES 2
Reeza
Super User

Write your regression code for two scenarios to see how you need to generalize it. 

 

https://stats.idre.ucla.edu/sas/seminars/sas-macros-introduction/

 

 

Spoiler

@Agent1592 wrote:

Dear SAS Community:

I have panel data by firmid and date (quarters). I have in addition ni(net income) variable, return (ret) variable, cnt_ni which is the maximum number of quarters for each firm, and a simple count variable which counts the beginning and end of the quarters for each firm.

I would like to do a loop (rolling regression). Basically I am trying to set the minimum number of firm-quarter observations to 8. So if for firmid count is between 1 and 8 we have 1 regression, between 2 and 9 another one and so on. I know we have to use proc append but not sure how to do the rolling regression macro code.

PROC REG 
	DATA=test
	OUTEST=result RSQUARE NOPRINT;
	MODEL ret = ni;
	BY gvkey;
quit;
PROC APPEND BASE = result1 DATA = result;

 

data WORK.TEST;
  infile datalines dsd truncover;
  input firmid:$6. date:DATE9. ni:32. ret:32. cnt_ni:32. count:32.;
  format DATADATE DATE9.;
datalines4;
001000,31MAR1974,0.0665995976,0.5326963611,4,1
001000,31MAR1975,0.0415868673,0.1372751617,4,2
001000,31MAR1976,0.0790957374,0.3245687106,4,3
001000,31MAR1977,0.0443647682,0.1569266899,4,4
001001,31MAR1984,0.0099350549,-0.089042546,2,1
001001,31MAR1985,0.0218236173,0.3089041323,2,2
001003,31MAR1984,0.004827574,0.0144893592,1,1
001010,31MAR1974,0.0198241995,-0.072868616,7,1
001010,31MAR1975,0.0338809379,0.0169092395,7,2
001010,31MAR1977,0.026357479,0.0577793999,7,3
001010,31MAR1978,0.0247460739,-0.074640094,7,4
001010,31MAR1979,0.042475451,-0.02726128,7,5
001010,31MAR1980,0.0531934616,0.008752185,7,6
001010,31MAR1982,0.0361521597,-0.073388263,7,7
001011,31MAR1984,0.0125562663,-0.307994198,9,1
001011,31MAR1985,0.0331084121,0.7183596413,9,2
001011,31MAR1986,0.0072887533,0.1274002613,9,3
001011,31MAR1987,0.0065975754,-0.214663501,9,4
001011,31MAR1988,0.2380685444,0.1659101009,9,5
001011,31MAR1989,-0.006062443,-0.086984159,9,6
001011,31MAR1990,-0.06339814,-0.250317093,9,7
001011,31MAR1993,-0.023737663,0.1708571778,9,8
001011,31MAR1994,-0.0101768,0.2146591016,9,9
001019,31MAR1982,0.0719112584,0.1901397356,6,1
001019,31MAR1983,0.0580145036,0.0313360768,6,2
001019,31MAR1984,0.0227621841,-0.047551785,6,3
001019,31MAR1985,0.0216225277,-0.101864693,6,4
001019,31MAR1986,0.0221338945,0.3334400777,6,5
001019,31MAR1987,0.0149797088,-0.161109305,6,6
001020,31MAR1974,-0.019803546,-0.011904327,12,1
001020,31MAR1975,-1.283211783,1.2926711476,12,2
001020,31MAR1977,-0.163340051,0.4879558908,12,3
001020,31MAR1979,0.0279549159,-0.109228714,12,4
001020,31MAR1980,0.0512278481,-0.215027076,12,5
001020,31MAR1981,0.075783766,0.7372587782,12,6
001020,31MAR1982,0.0301958173,-0.209269385,12,7
001020,31MAR1983,0.0175104874,0.0091419375,12,8
001020,31MAR1984,0.0198688474,-0.059921752,12,9
001020,31MAR1985,0.0225972966,0.0531489587,12,10
001020,31MAR1986,0.0244611816,0.1818212542,12,11
001020,31MAR1987,0.0186582875,0.0567705826,12,12
001023,31MAR1984,0.0117067682,-0.253660282,4,1
001023,31MAR1985,0.0283010719,-0.129046683,4,2
001023,31MAR1986,0.0129968279,-0.143067865,4,3
001023,31MAR1987,0.019586406,0.0469880491,4,4
001034,31MAR1985,0.0351605193,0.2875440121,21,1
001034,31MAR1986,0.0149382745,0.0897110788,21,2
001034,31MAR1987,0.0139458584,-0.26166755,21,3
001034,31MAR1988,0.0240439697,0.4371398585,21,4
001034,31MAR1989,0.0181328461,-0.084153038,21,5
001034,31MAR1990,0.0171208385,0.2465843625,21,6
001034,31MAR1992,0.0085500295,-0.046869677,21,7
001034,31MAR1993,0.0070436275,-0.114086174,21,8
001034,31MAR1994,0.0117716089,0.190497974,21,9
001034,31MAR1995,0.0089751417,0.0385512522,21,10
001034,31MAR1996,0.0084407365,-0.158741892,21,11
001034,31MAR1997,0.0070999272,-0.061132038,21,12
001034,31MAR1998,0.0098002532,-0.118179653,21,13
001034,31MAR1999,0.0078055079,0.0693491002,21,14
001034,31MAR2000,0.0128585583,0.1459849388,21,15
001034,31MAR2001,0.0134930543,-0.14974307,21,16
001034,31MAR2002,-0.027024143,-0.463447952,21,17
001034,31MAR2003,0.0126373009,0.5558097004,21,18
001034,31MAR2004,-0.003004159,-0.048507768,21,19
001034,31MAR2005,-0.013081663,-0.254203545,21,20
001034,31MAR2006,0.004660247,-0.108773113,21,21
001036,31MAR1984,0.0041725127,-0.18442912,9,1
001036,31MAR1986,-0.007745477,0.110762778,9,2
001036,31MAR1987,-0.029669298,0.0181943333,9,3
001036,31MAR1989,0.0096336525,0.0368024609,9,4
001036,31MAR1990,0.0084882237,-0.077870296,9,5
001036,31MAR1991,0.0907357119,0.2283483425,9,6
001036,31MAR1993,0.0050308517,0.498389129,9,7
001036,31MAR1995,0.0123285376,-0.103926165,9,8
001036,31MAR2000,0.0093035563,-0.128989395,9,9
001039,31MAR1974,0.1233660877,0.2256237273,5,1
001039,31MAR1975,0.0949533645,0.0910929667,5,2
001039,31MAR1976,0.0865539122,0.2119969366,5,3
001039,31MAR1977,0.0682695646,0.0564982844,5,4
001039,31MAR1978,0.0754513676,0.3961006657,5,5
001040,31MAR1982,0.0165751704,-0.277851534,3,1
001040,31MAR1983,-0.007920031,-0.08916232,3,2
001040,31MAR1984,-0.00375779,-0.090439538,3,3
001045,31MAR1974,-0.042732408,0.2775407958,35,1
001045,31MAR1976,-0.034897253,-0.040294874,35,2
001045,31MAR1978,-0.022929931,-0.000830084,35,3
001045,31MAR1979,-0.017954165,-0.157874064,35,4
001045,31MAR1980,-0.21480862,-0.069184531,35,5
001045,31MAR1981,0.0124553782,0.6150094541,35,6
001045,31MAR1982,-0.131528383,0.3596825872,35,7
001045,31MAR1983,-0.030482316,-0.049490765,35,8
001045,31MAR1984,0.0345199593,-0.000258757,35,9
001045,31MAR1985,0.0344014037,0.0573054094,35,10
001045,31MAR1986,0.0056953951,0.2147262011,35,11
001045,31MAR1987,0.0063216044,-0.195480012,35,12
001045,31MAR1988,0.0329914569,0.1373763559,35,13
001045,31MAR1989,0.0320314606,0.0372866456,35,14
001045,31MAR1990,-0.005349817,0.1515149583,35,15
001045,31MAR1991,-0.064902261,0.0398757932,35,16
001045,31MAR1992,0.0016687526,0.0587493906,35,17
001045,31MAR1993,-0.004322625,-0.077880096,35,18
001045,31MAR1994,-0.001378333,-0.113313083,35,19
001045,31MAR1996,0.0276764151,0.142853597,35,20
001045,31MAR1999,0.0017744903,-0.047608184,35,21
001045,31MAR2000,0.0089605599,0.0058441005,35,22
001045,31MAR2001,-0.007216014,0.0253946289,35,23
001045,31MAR2002,-0.166907812,0.1811353839,35,24
001045,31MAR2003,-1.012437155,-0.663134262,35,25
001045,31MAR2004,-0.080325681,-0.037442629,35,26
001045,31MAR2005,-0.091802481,0.0013851271,35,27
001045,31MAR2006,-0.022648203,0.1530692954,35,28
001045,31MAR2007,0.0120574623,-0.008761835,35,29
001045,31MAR2009,-0.12599173,-0.663685585,35,30
001045,31MAR2010,-0.196407606,0.1181472525,35,31
001045,31MAR2011,-0.167848827,-0.216864556,35,32
001045,31MAR2014,0.0728156196,0.4221753747,35,33
001045,31MAR2015,0.0249160658,-0.028671836,35,34
001045,31MAR2016,0.0264622854,-0.036169656,35,35
001047,31MAR1982,-0.049866667,-0.261407789,1,1
001050,31MAR1994,-0.000161823,0.0550892758,20,1
001050,31MAR1999,0.0066658587,0.2070812387,20,2
001050,31MAR2001,-0.031355913,0.4390704961,20,3
001050,31MAR2002,-0.006209379,0.1397301132,20,4
001050,31MAR2003,-0.038384579,-0.017744084,20,5
001050,31MAR2004,-0.025553482,0.0303087536,20,6
001050,31MAR2005,-0.018384962,-0.001645273,20,7
001050,31MAR2006,-0.012831505,0.4417373686,20,8
001050,31MAR2007,0.0111045914,0.3709199468,20,9
001050,31MAR2008,-0.003541006,-0.15064581,20,10
001050,31MAR2009,0.0169351381,0.3878466696,20,11
001050,31MAR2010,0.0029588131,-0.150581733,20,12
001050,31MAR2011,0.0147408217,-0.071419168,20,13
001050,31MAR2012,0.025383609,0.2463082036,20,14
001050,31MAR2013,0.0130850609,0.1859967891,20,15
001050,31MAR2014,0.0073097925,0.0139136615,20,16
001050,31MAR2015,0.0004850692,-0.324493189,20,17
001050,31MAR2016,0.0119006378,-0.188584229,20,18
001050,31MAR2017,0.0000797381,-0.282684776,20,19
001050,31MAR2018,0.0324961473,-0.122880434,20,20
001065,31MAR1984,-0.018073056,-0.343261574,6,1
001065,31MAR1985,-0.02896186,0.5330668184,6,2
001065,31MAR1987,-0.026678506,0.4533936167,6,3
001065,31MAR1988,-0.046241723,0.267182886,6,4
001065,31MAR1989,-0.050941708,0.0296168742,6,5
001065,31MAR1990,-0.041861192,0.0984758348,6,6
001070,31MAR1974,-0.097944719,0.2648562717,4,1
001070,31MAR1975,0.1703488006,0.08858129,4,2
001070,31MAR1978,-0.020207905,0.0265213508,4,3
001070,31MAR1979,0.0229018314,0.326417502,4,4
001072,31MAR1974,0.0358560607,0.0134560633,15,1
001072,31MAR1976,0.0572189501,0.5914491489,15,2
001072,31MAR1977,0.0319121987,0.0741357758,15,3
001072,31MAR1978,0.0464532719,0.592061817,15,4
001072,31MAR1979,0.0379014988,0.2013772034,15,5
001072,31MAR1980,0.0229654742,-0.086899171,15,6
001072,31MAR1981,0.0081669043,0.1382939483,15,7
001072,31MAR1982,0.0090680667,0.4655018476,15,8
001072,31MAR1983,0.0055468992,0.0943214783,15,9
001072,31MAR1984,0.0160037758,-0.194515725,15,10
001072,31MAR1985,0.0010802282,-0.073402458,15,11
001072,31MAR1986,-0.01514784,-0.123708826,15,12
001072,31MAR1987,0.0249411765,0.3366279342,15,13
001072,31MAR1988,0.0288282272,-0.014838289,15,14
001072,31MAR1989,0.0284148696,-0.050330071,15,15
001073,31MAR1982,-0.00510949,0.6007029872,12,1
001073,31MAR1983,-0.002056226,0.5226942184,12,2
001073,31MAR1984,0.0021847394,0.3129916636,12,3
001073,31MAR1985,0.0044070523,0.1999522772,12,4
001073,31MAR1986,0.0088888889,0.1374106584,12,5
001073,31MAR1988,-0.119848277,-0.082223209,12,6
001073,31MAR1989,-0.207667284,3.6165993552,12,7
001073,31MAR1990,-0.128449188,0.4031268681,12,8
001073,31MAR1991,-1.334716869,0.0416287429,12,9
001073,31MAR1993,0.0085865794,-0.155137616,12,10
001073,31MAR1994,-0.011697128,-0.417767521,12,11
001073,31MAR1995,-0.105228789,-0.038769453,12,12
001074,31MAR1974,0.0432469935,0.3223594277,6,1
001074,31MAR1975,-0.013904705,-0.013137406,6,2
001074,31MAR1976,0.0049343554,-0.097210658,6,3
001074,31MAR1979,0.0197610331,0.2109592967,6,4
001074,31MAR1980,0.077294686,0.1365351694,6,5
001074,31MAR1981,0.0419024073,-0.072879051,6,6
001075,31MAR1974,0.0262135172,0.0406609417,36,1
001075,31MAR1975,0.0528055556,-0.065632525,36,2
001075,31MAR1977,0.0347447983,0.0419719849,36,3
001075,31MAR1978,0.0341130432,0.0103854887,36,4
001075,31MAR1979,0.025870303,-0.061764528,36,5
001075,31MAR1980,0.0364321126,-0.037523162,36,6
001075,31MAR1981,0.0308702131,-0.056056403,36,7
001075,31MAR1982,0.0396651818,0.1845629591,36,8
001075,31MAR1983,0.033316129,-0.093508249,36,9
001075,31MAR1984,0.0397083037,-0.002078712,36,10
001075,31MAR1985,0.0382540757,-0.028722367,36,11
001075,31MAR1986,0.029077038,-0.011650098,36,12
001075,31MAR1989,0.0359154347,-0.135368628,36,13
001075,31MAR1990,0.0217100977,0.3157038948,36,14
001075,31MAR1991,0.0154743131,-0.075898544,36,15
001075,31MAR1992,0.0106409666,0.0258529721,36,16
001075,31MAR1993,0.0199124316,0.0153694429,36,17
001075,31MAR1994,0.0148912741,-0.062121371,36,18
;;;;

 

 


 

 

PaigeMiller
Diamond | Level 26

Well, I guess the answer depends on what you mean by "simple". I'm going to state my opinion that this is not "simple".

 

Nevertheless, there are examples out there on the Internet, such as this one (no macros required)

http://pages.stern.nyu.edu/~adesouza/sasfinphd/index/node25.html

 

If you really want a macro, then your favorite internet search engine will find rolling regression macros for you to use.

--
Paige Miller

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 2 replies
  • 1211 views
  • 0 likes
  • 3 in conversation
OSZAR »