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

Hi everybody

I have a problem with a regression code. I have daily stock returns from 1990 to 2011 for many firms. I also have daily returns of an index from 1990 to 2011. I downloaded the two data sets separately and combined them with a proc sql as a left join step. Now the dates of the daily stock returns match exactly the dates of the daily returns of the index, which is perfect. I need to estimate market betas for every firm, every firm has a unique identifier which in this case is the CUSIP. I need to estimate the market betas for every quarter (3 month), semi year (6 month) and every year (12 month), these are my intervals. The dependent variable is the daily stock return of the individual firms called: ret, the independent variable is the daily index return called: vwretd

Is there a SAS code which does the regression for every quarter, semi year and year, that is: is there a SAS code which gives me the slope for every quarter, semi year and year for every firm. Always after the year 2011 a new cusip number starts for a new firm. The daily index returns are always the same for every firm. The optimal output would be something like this where we have the cusip of the relevant firm with the slope coefficient:

CUSIP         QUARTER          YEAR          SLOPE_COEFFICIENT

So when I would do the regression on a yearly frequency I would have one slope coefficient per year.

For the semi year frequency I would have 2 slope coefficients per year and for the quarterly frequency I would have 4 slope coefficients per year.

The outputs can be given in separate files, one for the quarterly, semi yearly and yearly regressions.

Here is an extract of the data set for two years (1990, 1991) on a daily basis:

cusip          date          prc          ret              caldt          vwretd

00036110 19900102 36.00000 0.000000 19900102 0.015013

00036110 19900103 36.25000 0.006944 19900103 -0.000412

00036110 19900104 35.50000 -0.020690 19900104 -0.006889

00036110 19900105 35.87500 0.010563 19900105 -0.008298

00036110 19900108 35.25000 -0.017422 19900108 0.003353

00036110 19900109 35.12500 -0.003546 19900109 -0.009937

00036110 19900110 35.12500 0.000000 19900110 -0.005951

00036110 19900111 34.37500 -0.021352 19900111 0.003523

00036110 19900112 33.75000 -0.018182 19900112 -0.022824

00036110 19900115 33.25000 -0.014815 19900115 -0.009168

00036110 19900116 32.12500 -0.033835 19900116 0.008767

00036110 19900117 30.87500 -0.038911 19900117 -0.007445

00036110 19900118 31.50000 0.020243 19900118 0.000750

00036110 19900119 32.62500 0.035714 19900119 0.002562

00036110 19900122 31.87500 -0.022989 19900122 -0.022508

00036110 19900123 31.75000 -0.000157 19900123 0.000405

00036110 19900124 30.37500 -0.043307 19900124 -0.003904

00036110 19900125 30.25000 -0.004115 19900125 -0.011007

00036110 19900126 30.12500 -0.004132 19900126 -0.002615

00036110 19900129 30.75000 0.020747 19900129 -0.002343

00036110 19900130 30.87500 0.004065 19900130 -0.007417

00036110 19900131 31.50000 0.020243 19900131 0.016820

00036110 19900201 31.87500 0.011905 19900201 0.000592

00036110 19900202 31.50000 -0.011765 19900202 0.006758

00036110 19900205 31.37500 -0.003968 19900205 0.004019

00036110 19900206 31.37500 0.000000 19900206 -0.005170

00036110 19900207 30.87500 -0.015936 19900207 0.011017

00036110 19900208 30.62500 -0.008097 19900208 -0.000772

00036110 19900209 31.37500 0.024490 19900209 0.002307

00036110 19900212 30.25000 -0.035857 19900212 -0.009170

00036110 19900213 30.25000 0.000000 19900213 0.001878

00036110 19900214 30.50000 0.008264 19900214 0.002080

00036110 19900215 31.00000 0.016393 19900215 0.007752

00036110 19900216 31.37500 0.012097 19900216 -0.004777

00036110 19900220 30.87500 -0.015936 19900220 -0.012874

00036110 19900221 31.37500 0.016194 19900221 -0.001482

00036110 19900222 31.00000 -0.011952 19900222 -0.004034

00036110 19900223 30.62500 -0.012097 19900223 -0.005135

00036110 19900226 30.62500 0.000000 19900226 0.010150

00036110 19900227 30.87500 0.008163 19900227 0.005342

00036110 19900228 31.12500 0.008097 19900228 0.005296

00036110 19900301 31.37500 0.008032 19900301 0.002895

00036110 19900302 31.37500 0.000000 19900302 0.007892

00036110 19900305 31.75000 0.011952 19900305 -0.003457

00036110 19900306 31.62500 -0.003937 19900306 0.010857

00036110 19900307 27.50000 -0.130435 19900307 -0.001929

00036110 19900308 28.75000 0.045455 19900308 0.008404

00036110 19900309 28.87500 0.004348 19900309 -0.005488

00036110 19900312 28.75000 -0.004329 19900312 0.002005

00036110 19900313 28.37500 -0.013043 19900313 -0.006634

00036110 19900314 28.12500 -0.008811 19900314 0.002473

00036110 19900315 28.00000 -0.004444 19900315 0.002477

00036110 19900316 29.75000 0.062500 19900316 0.008885

00036110 19900319 29.50000 -0.008403 19900319 0.004183

00036110 19900320 29.75000 0.008475 19900320 -0.004906

00036110 19900321 29.75000 0.000000 19900321 -0.004391

00036110 19900322 29.37500 -0.012605 19900322 -0.011649

00036110 19900323 29.25000 -0.004255 19900323 0.004228

00036110 19900326 29.87500 0.021368 19900326 0.001441

00036110 19900327 30.00000 0.004184 19900327 0.008567

00036110 19900328 29.62500 -0.012500 19900328 0.002361

00036110 19900329 30.00000 0.012658 19900329 -0.002982

00036110 19900330 30.00000 0.000000 19900330 -0.001640

00036110 19900402 29.75000 -0.008333 19900402 -0.003860

00036110 19900403 29.62500 -0.004202 19900403 0.012997

00036110 19900404 29.50000 -0.004219 19900404 -0.006155

00036110 19900405 29.50000 0.000000 19900405 -0.000485

00036110 19900406 29.50000 0.000000 19900406 -0.001795

00036110 19900409 29.00000 -0.016949 19900409 0.002538

00036110 19900410 28.62500 -0.012931 19900410 0.001325

00036110 19900411 28.62500 0.000000 19900411 -0.000582

00036110 19900412 29.25000 0.021834 19900412 0.006882

00036110 19900416 29.00000 -0.008547 19900416 0.000872

00036110 19900417 28.75000 -0.008621 19900417 -0.000458

00036110 19900418 27.87500 -0.030435 19900418 -0.010184

00036110 19900419 25.50000 -0.085202 19900419 -0.007450

00036110 19900420 23.00000 -0.098039 19900420 -0.008673

00036110 19900423 21.75000 -0.054348 19900423 -0.010696

00036110 19900424 22.00000 0.011494 19900424 -0.002252

00036110 19900425 21.37500 -0.028409 19900425 0.004647

00036110 19900426 21.00000 -0.017544 19900426 0.002123

00036110 19900427 20.62500 -0.017857 19900427 -0.010598

00036110 19900430 21.62500 0.048485 19900430 0.004336

00036110 19900501 22.12500 0.028671 19900501 0.004245

00036110 19900502 22.62500 0.022599 19900502 0.005916

00036110 19900503 22.25000 -0.016575 19900503 0.003494

00036110 19900504 22.00000 -0.011236 19900504 0.007883

00036110 19900507 21.87500 -0.005682 19900507 0.005935

00036110 19900508 22.00000 0.005714 19900508 0.004131

00036110 19900509 21.87500 -0.005682 19900509 0.001723

00036110 19900510 21.62500 -0.011429 19900510 0.004102

00036110 19900511 21.87500 0.011561 19900511 0.020919

00036110 19900514 22.00000 0.005714 19900514 0.007797

00036110 19900515 22.25000 0.011364 19900515 -0.001292

00036110 19900516 22.00000 -0.011236 19900516 -0.000979

00036110 19900517 21.62500 -0.017045 19900517 0.001954

00036110 19900518 21.00000 -0.028902 19900518 0.000411

00036110 19900521 21.00000 0.000000 19900521 0.009257

00036110 19900522 21.62500 0.029762 19900522 0.001548

00036110 19900523 21.62500 0.000000 19900523 0.001414

00036110 19900524 21.50000 -0.005780 19900524 -0.001062

00036110 19900525 21.37500 -0.005814 19900525 -0.008675

00036110 19900529 21.75000 0.017544 19900529 0.014378

00036110 19900530 21.25000 -0.022989 19900530 0.001022

00036110 19900531 21.25000 0.000000 19900531 0.001231

00036110 19900601 21.00000 -0.011765 19900601 0.005287

00036110 19900604 21.62500 0.029762 19900604 0.011203

00036110 19900605 21.50000 -0.005780 19900605 -0.001433

00036110 19900606 21.50000 0.000000 19900606 -0.003550

00036110 19900607 21.00000 -0.023256 19900607 -0.004580

00036110 19900608 20.50000 -0.023810 19900608 -0.010660

00036110 19900611 20.00000 -0.024390 19900611 0.006833

00036110 19900612 19.75000 -0.012500 19900612 0.011182

00036110 19900613 19.62500 -0.006329 19900613 -0.002984

00036110 19900614 19.50000 -0.006369 19900614 -0.004946

00036110 19900615 19.50000 0.000000 19900615 -0.000881

00036110 19900618 19.50000 0.000000 19900618 -0.014086

00036110 19900619 19.50000 0.000000 19900619 0.003517

00036110 19900620 19.50000 0.000000 19900620 0.001136

00036110 19900621 20.12500 0.032051 19900621 0.002903

00036110 19900622 21.00000 0.043478 19900622 -0.010781

00036110 19900625 20.50000 -0.023810 19900625 -0.007998

00036110 19900626 21.37500 0.042683 19900626 -0.001000

00036110 19900627 21.50000 0.005848 19900627 0.007010

00036110 19900628 23.00000 0.069767 19900628 0.006611

00036110 19900629 24.00000 0.043478 19900629 0.001930

00036110 19900702 23.62500 -0.015625 19900702 0.003631

00036110 19900703 23.25000 -0.015873 19900703 0.002235

00036110 19900705 22.75000 -0.021505 19900705 -0.010393

00036110 19900706 22.37500 -0.016484 19900706 0.006627

00036110 19900709 22.75000 0.016760 19900709 0.002181

00036110 19900710 22.00000 -0.032967 19900710 -0.006697

00036110 19900711 22.50000 0.022727 19900711 0.011065

00036110 19900712 23.00000 0.022222 19900712 0.010971

00036110 19900713 22.75000 -0.010870 19900713 0.004856

00036110 19900716 22.87500 0.005495 19900716 0.004325

00036110 19900717 22.62500 -0.010929 19900717 -0.003236

00036110 19900718 22.75000 0.005525 19900718 -0.008418

00036110 19900719 22.62500 -0.005495 19900719 0.002391

00036110 19900720 23.00000 0.016575 19900720 -0.008046

00036110 19900723 21.50000 -0.065217 19900723 -0.017341

00036110 19900724 21.00000 -0.023256 19900724 0.000913

00036110 19900725 22.25000 0.059524 19900725 0.003502

00036110 19900726 21.75000 -0.022472 19900726 -0.002458

00036110 19900727 22.37500 0.028736 19900727 -0.006148

00036110 19900730 22.25000 -0.005587 19900730 0.004223

00036110 19900731 21.75000 -0.017079 19900731 0.002189

00036110 19900801 22.00000 0.011494 19900801 -0.000889

00036110 19900802 21.62500 -0.017045 19900802 -0.010355

00036110 19900803 20.37500 -0.057803 19900803 -0.016714

00036110 19900806 19.50000 -0.042945 19900806 -0.030303

00036110 19900807 18.87500 -0.032051 19900807 0.001625

00036110 19900808 19.00000 0.006623 19900808 0.010303

00036110 19900809 19.62500 0.032895 19900809 0.005052

00036110 19900810 19.00000 -0.031847 19900810 -0.010780

00036110 19900813 18.87500 -0.006579 19900813 0.007697

00036110 19900814 18.37500 -0.026490 19900814 0.002269

00036110 19900815 18.75000 0.020408 19900815 0.002819

00036110 19900816 18.00000 -0.040000 19900816 -0.020180

00036110 19900817 17.62500 -0.020833 19900817 -0.013535

00036110 19900820 17.25000 -0.021277 19900820 0.000585

00036110 19900821 16.50000 -0.043478 19900821 -0.018690

00036110 19900822 16.25000 -0.015152 19900822 -0.015039

00036110 19900823 16.00000 -0.015385 19900823 -0.030410

00036110 19900824 15.75000 -0.015625 19900824 0.013092

00036110 19900827 16.12500 0.023810 19900827 0.029555

00036110 19900828 16.25000 0.007752 19900828 0.000539

00036110 19900829 15.75000 -0.030769 19900829 0.008548

00036110 19900830 15.75000 0.000000 19900830 -0.013818

00036110 19900831 15.87500 0.007937 19900831 0.009697

00036110 19900904 15.62500 -0.015748 19900904 0.000917

00036110 19900905 15.75000 0.008000 19900905 0.004217

00036110 19900906 15.37500 -0.023810 19900906 -0.009725

00036110 19900907 15.25000 -0.008130 19900907 0.007900

00036110 19900910 15.25000 0.000000 19900910 -0.004080

00036110 19900911 15.50000 0.016393 19900911 -0.001112

00036110 19900912 15.87500 0.024194 19900912 0.003266

00036110 19900913 15.25000 -0.039370 19900913 -0.010162

00036110 19900914 14.50000 -0.049180 19900914 -0.005776

00036110 19900917 14.37500 -0.008621 19900917 0.002500

00036110 19900918 14.62500 0.017391 19900918 0.001752

00036110 19900919 14.50000 -0.008547 19900919 -0.005489

00036110 19900920 13.62500 -0.060345 19900920 -0.014798

00036110 19900921 13.87500 0.018349 19900921 -0.001150

00036110 19900924 13.37500 -0.036036 19900924 -0.019792

00036110 19900925 13.00000 -0.028037 19900925 0.010016

00036110 19900926 13.00000 0.000000 19900926 -0.009921

00036110 19900927 12.50000 -0.038462 19900927 -0.013002

00036110 19900928 12.25000 -0.020000 19900928 0.014865

00036110 19901001 12.50000 0.020408 19901001 0.025729

00036110 19901002 12.62500 0.010000 19901002 0.002323

00036110 19901003 12.50000 -0.009901 19901003 -0.009870

00036110 19901004 12.25000 -0.020000 19901004 0.002304

00036110 19901005 12.12500 -0.010204 19901005 -0.003850

00036110 19901008 11.75000 -0.030928 19901008 0.005727

00036110 19901009 10.50000 -0.106383 19901009 -0.023998

00036110 19901010 10.00000 -0.047619 19901010 -0.014823

00036110 19901011 9.50000 -0.050000 19901011 -0.016548

00036110 19901012 9.87500 0.039474 19901012 0.012988

00036110 19901015 10.12500 0.025316 19901015 0.008662

00036110 19901016 10.00000 -0.012346 19901016 -0.013276

00036110 19901017 10.75000 0.075000 19901017 -0.000357

00036110 19901018 11.62500 0.081395 19901018 0.021516

00036110 19901019 11.37500 -0.021505 19901019 0.018141

00036110 19901022 11.62500 0.021978 19901022 0.007482

00036110 19901023 12.12500 0.053333 19901023 -0.005006

00036110 19901024 11.87500 -0.020619 19901024 0.000292

00036110 19901025 11.62500 -0.021053 19901025 -0.005902

00036110 19901026 11.00000 -0.053763 19901026 -0.015954

00036110 19901029 10.87500 -0.011364 19901029 -0.008762

00036110 19901030 10.62500 -0.022989 19901030 0.005000

00036110 19901031 10.50000 -0.011765 19901031 0.000589

00036110 19901101 10.25000 -0.023810 19901101 0.008676

00036110 19901102 10.25000 0.000000 19901102 0.014669

00036110 19901105 10.37500 0.012195 19901105 0.009245

00036110 19901106 10.37500 0.000000 19901106 -0.007181

00036110 19901107 10.00000 -0.036145 19901107 -0.015669

00036110 19901108 10.00000 0.000000 19901108 0.004652

00036110 19901109 10.25000 0.025000 19901109 0.017682

00036110 19901112 10.37500 0.012195 19901112 0.017351

00036110 19901113 10.87500 0.048193 19901113 -0.003734

00036110 19901114 10.87500 0.000000 19901114 0.007586

00036110 19901115 11.37500 0.045977 19901115 -0.008675

00036110 19901116 11.00000 -0.032967 19901116 0.000948

00036110 19901119 11.25000 0.022727 19901119 0.005697

00036110 19901120 11.50000 0.022222 19901120 -0.010012

00036110 19901121 11.75000 0.021739 19901121 0.000953

00036110 19901123 11.12500 -0.053191 19901123 -0.002254

00036110 19901126 11.25000 0.011236 19901126 0.003462

00036110 19901127 11.37500 0.011111 19901127 0.005700

00036110 19901128 11.37500 0.000000 19901128 0.000472

00036110 19901129 11.50000 0.010989 19901129 -0.004168

00036110 19901130 11.87500 0.032609 19901130 0.016495

00036110 19901203 12.12500 0.021053 19901203 0.006621

00036110 19901204 12.25000 0.010309 19901204 0.007118

00036110 19901205 13.75000 0.122449 19901205 0.010690

00036110 19901206 13.37500 -0.027273 19901206 -0.002019

00036110 19901207 13.12500 -0.018692 19901207 -0.003409

00036110 19901210 12.37500 -0.057143 19901210 0.002659

00036110 19901211 12.75000 0.030303 19901211 -0.005275

00036110 19901212 12.75000 0.000000 19901212 0.009454

00036110 19901213 10.25000 -0.196078 19901213 -0.001071

00036110 19901214 9.62500 -0.060976 19901214 -0.007392

00036110 19901217 9.25000 -0.038961 19901217 -0.003267

00036110 19901218 9.25000 0.000000 19901218 0.011460

00036110 19901219 9.62500 0.040541 19901219 0.000782

00036110 19901220 10.12500 0.051948 19901220 0.000334

00036110 19901221 10.00000 -0.012346 19901221 0.002946

00036110 19901224 9.87500 -0.012500 19901224 -0.003827

00036110 19901226 10.12500 0.025316 19901226 0.002950

00036110 19901227 10.00000 -0.012346 19901227 -0.005935

00036110 19901228 10.37500 0.037500 19901228 0.000411

00036110 19901231 11.50000 0.108434 19901231 0.004732

00036110 19910102 11.00000 -0.043478 19910102 -0.009358

00036110 19910103 11.00000 0.000000 19910103 -0.011735

00036110 19910104 10.87500 -0.011364 19910104 -0.002476

00036110 19910107 10.50000 -0.034483 19910107 -0.016102

00036110 19910108 10.25000 -0.023810 19910108 -0.002664

00036110 19910109 10.25000 0.000000 19910109 -0.009665

00036110 19910110 10.25000 0.000000 19910110 0.009080

00036110 19910111 10.25000 0.000000 19910111 0.000972

00036110 19910114 10.12500 -0.012195 19910114 -0.008684

00036110 19910115 9.87500 -0.024691 19910115 0.002995

00036110 19910116 9.87500 0.000000 19910116 0.007996

00036110 19910117 10.00000 0.012658 19910117 0.033564

00036110 19910118 9.75000 -0.025000 19910118 0.009737

00036110 19910121 9.62500 -0.012821 19910121 -0.001710

00036110 19910122 9.50000 -0.012987 19910122 -0.006398

00036110 19910123 9.62500 0.013158 19910123 0.005049

00036110 19910124 9.87500 0.025974 19910124 0.013834

00036110 19910125 10.62500 0.075949 19910125 0.003867

00036110 19910128 10.50000 -0.011765 19910128 0.000953

00036110 19910129 10.50000 0.011429 19910129 0.000000

00036110 19910130 11.75000 0.119048 19910130 0.014434

00036110 19910131 12.12500 0.031915 19910131 0.009000

00036110 19910201 11.87500 -0.020619 19910201 -0.000717

00036110 19910204 12.00000 0.010526 19910204 0.015482

00036110 19910205 12.50000 0.041667 19910205 0.009392

00036110 19910206 12.75000 0.020000 19910206 0.018040

00036110 19910207 13.00000 0.019608 19910207 -0.002650

00036110 19910208 13.25000 0.019231 19910208 0.006966

00036110 19910211 13.62500 0.028302 19910211 0.024217

00036110 19910212 13.25000 -0.027523 19910212 -0.006109

00036110 19910213 12.75000 -0.037736 19910213 0.008766

00036110 19910214 12.00000 -0.058824 19910214 -0.011492

00036110 19910215 12.87500 0.072917 19910215 0.011925

00036110 19910219 12.87500 0.000000 19910219 0.001255

00036110 19910220 12.37500 -0.038835 19910220 -0.010396

00036110 19910221 12.75000 0.030303 19910221 -0.000400

00036110 19910222 12.50000 -0.019608 19910222 0.001760

00036110 19910225 12.75000 0.020000 19910225 0.004324

00036110 19910226 12.75000 0.000000 19910226 -0.010854

00036110 19910227 12.75000 0.000000 19910227 0.012019

00036110 19910228 12.87500 0.009804 19910228 0.000257

00036110 19910301 13.62500 0.058252 19910301 0.008393

00036110 19910304 13.37500 -0.018349 19910304 -0.000269

00036110 19910305 13.87500 0.037383 19910305 0.017864

00036110 19910306 14.25000 0.027027 19910306 -0.001309

00036110 19910307 14.12500 -0.008772 19910307 -0.000252

00036110 19910308 15.00000 0.061947 19910308 -0.001854

00036110 19910311 15.00000 0.000000 19910311 -0.004287

00036110 19910312 14.00000 -0.066667 19910312 -0.007531

00036110 19910313 15.25000 0.089286 19910313 0.010256

00036110 19910314 15.25000 0.000000 19910314 -0.001531

00036110 19910315 15.25000 0.000000 19910315 -0.001955

00036110 19910318 15.00000 -0.016393 19910318 -0.002792

00036110 19910319 14.37500 -0.041667 19910319 -0.012971

00036110 19910320 14.62500 0.017391 19910320 0.003172

00036110 19910321 14.62500 0.000000 19910321 -0.002322

00036110 19910322 14.37500 -0.017094 19910322 0.001844

00036110 19910325 14.50000 0.008696 19910325 0.006155

00036110 19910326 14.75000 0.017241 19910326 0.015352

00036110 19910327 14.50000 -0.016949 19910327 -0.000964

00036110 19910328 14.00000 -0.034483 19910328 -0.000357

00036110 19910401 14.00000 0.000000 19910401 -0.008476

00036110 19910402 14.12500 0.008929 19910402 0.018919

00036110 19910403 14.37500 0.017699 19910403 0.000389

00036110 19910404 14.37500 0.000000 19910404 0.002900

00036110 19910405 14.37500 0.000000 19910405 -0.009677

00036110 19910408 13.75000 -0.043478 19910408 0.006738

00036110 19910409 13.62500 -0.009091 19910409 -0.010527

00036110 19910410 13.00000 -0.045872 19910410 -0.001627

00036110 19910411 13.00000 0.000000 19910411 0.010682

00036110 19910412 13.62500 0.048077 19910412 0.006185

00036110 19910415 13.75000 0.009174 19910415 0.002468

00036110 19910416 13.62500 -0.009091 19910416 0.014603

00036110 19910417 13.62500 0.000000 19910417 0.007603

00036110 19910418 14.62500 0.073394 19910418 -0.004258

00036110 19910419 14.62500 0.000000 19910419 -0.009741

00036110 19910422 14.50000 -0.008547 19910422 -0.008805

00036110 19910423 13.87500 -0.043103 19910423 0.001555

00036110 19910424 13.87500 0.000000 19910424 0.002602

00036110 19910425 14.00000 0.009009 19910425 -0.007635

00036110 19910426 13.37500 -0.044643 19910426 -0.001164

00036110 19910429 13.00000 -0.028037 19910429 -0.012395

00036110 19910430 12.87500 -0.000385 19910430 0.003405

00036110 19910501 12.75000 -0.009709 19910501 0.012717

00036110 19910502 13.37500 0.049020 19910502 0.001224

00036110 19910503 13.12500 -0.018692 19910503 0.000583

00036110 19910506 13.50000 0.028571 19910506 -0.001619

00036110 19910507 13.12500 -0.027778 19910507 -0.005636

00036110 19910508 13.37500 0.019048 19910508 0.002372

00036110 19910509 13.25000 -0.009346 19910509 0.011551

00036110 19910510 12.87500 -0.028302 19910510 -0.016594

00036110 19910513 12.75000 -0.009709 19910513 0.002036

00036110 19910514 12.87500 0.009804 19910514 -0.012041

00036110 19910515 12.62500 -0.019417 19910515 -0.008117

00036110 19910516 13.00000 0.029703 19910516 0.009364

00036110 19910517 13.25000 0.019231 19910517 -0.000109

00036110 19910520 12.87500 -0.028302 19910520 0.000208

00036110 19910521 13.00000 0.009709 19910521 0.007449

00036110 19910522 13.00000 0.000000 19910522 0.001717

00036110 19910523 13.00000 0.000000 19910523 -0.002122

00036110 19910524 13.00000 0.000000 19910524 0.006332

00036110 19910528 12.87500 -0.009615 19910528 0.010764

00036110 19910529 12.87500 0.000000 19910529 0.002478

00036110 19910530 13.75000 0.067961 19910530 0.010300

00036110 19910531 14.12500 0.027273 19910531 0.007285

00036110 19910603 14.50000 0.026549 19910603 -0.003171

00036110 19910604 15.00000 0.034483 19910604 -0.000454

00036110 19910605 14.87500 -0.008333 19910605 -0.005367

00036110 19910606 14.62500 -0.016807 19910606 -0.003155

00036110 19910607 14.00000 -0.042735 19910607 -0.009099

00036110 19910610 14.00000 0.000000 19910610 -0.001777

00036110 19910611 15.00000 0.071429 19910611 0.004840

00036110 19910612 14.87500 -0.008333 19910612 -0.010363

00036110 19910613 14.75000 -0.008403 19910613 0.002403

00036110 19910614 14.87500 0.008475 19910614 0.010684

00036110 19910617 15.12500 0.016807 19910617 -0.004088

00036110 19910618 15.62500 0.033058 19910618 -0.003315

00036110 19910619 15.12500 -0.032000 19910619 -0.008797

00036110 19910620 14.75000 -0.024793 19910620 0.000075

00036110 19910621 14.50000 -0.016949 19910621 0.004778

00036110 19910624 14.12500 -0.025862 19910624 -0.015851

00036110 19910625 14.00000 -0.008850 19910625 -0.001426

00036110 19910626 14.12500 0.008929 19910626 0.001570

00036110 19910627 14.00000 -0.008850 19910627 0.006733

00036110 19910628 15.50000 0.107143 19910628 -0.006822

00036110 19910701 14.87500 -0.040323 19910701 0.016320

00036110 19910702 15.25000 0.025210 19910702 -0.000469

00036110 19910703 14.62500 -0.040984 19910703 -0.009271

00036110 19910705 14.75000 0.008547 19910705 0.002228

00036110 19910708 15.00000 0.016949 19910708 0.007618

00036110 19910709 14.50000 -0.033333 19910709 -0.002125

00036110 19910710 14.62500 0.008621 19910710 -0.000523

00036110 19910711 14.62500 0.000000 19910711 0.002993

00036110 19910712 14.87500 0.017094 19910712 0.007400

00036110 19910715 15.25000 0.025210 19910715 0.006014

00036110 19910716 15.37500 0.008197 19910716 -0.001262

00036110 19910717 15.50000 0.008130 19910717 -0.000084

00036110 19910718 15.62500 0.008065 19910718 0.009254

00036110 19910719 15.25000 -0.024000 19910719 -0.002349

00036110 19910722 15.62500 0.024590 19910722 -0.003172

00036110 19910723 15.62500 0.000000 19910723 -0.008087

00036110 19910724 16.00000 0.024000 19910724 -0.002509

00036110 19910725 16.62500 0.039063 19910725 0.005240

00036110 19910726 16.62500 0.000000 19910726 0.000284

00036110 19910729 16.25000 -0.022556 19910729 0.005236

00036110 19910730 16.62500 0.030462 19910730 0.008529

00036110 19910731 16.62500 0.000000 19910731 0.003469

00036110 19910801 16.37500 -0.015038 19910801 -0.001580

00036110 19910802 16.12500 -0.015267 19910802 0.000541

00036110 19910805 16.00000 -0.007752 19910805 -0.004622

00036110 19910806 16.12500 0.007813 19910806 0.012857

00036110 19910807 16.62500 0.031008 19910807 0.000661

00036110 19910808 16.37500 -0.015038 19910808 -0.002188

00036110 19910809 16.37500 0.000000 19910809 -0.004169

00036110 19910812 16.87500 0.030534 19910812 0.001743

00036110 19910813 16.75000 -0.007407 19910813 0.003871

00036110 19910814 16.62500 -0.007463 19910814 0.001750

00036110 19910815 16.75000 0.007519 19910815 -0.000948

00036110 19910816 16.75000 0.000000 19910816 -0.008191

00036110 19910819 16.50000 -0.014925 19910819 -0.022270

00036110 19910820 16.12500 -0.022727 19910820 0.006813

00036110 19910821 16.75000 0.038760 19910821 0.026384

00036110 19910822 16.50000 -0.014925 19910822 0.002436

00036110 19910823 16.50000 0.000000 19910823 0.006257

00036110 19910826 16.50000 0.000000 19910826 -0.000380

00036110 19910827 16.12500 -0.022727 19910827 -0.001151

00036110 19910828 15.87500 -0.015504 19910828 0.008346

00036110 19910829 16.25000 0.023622 19910829 0.000023

00036110 19910830 16.25000 0.000000 19910830 -0.001496

00036110 19910903 16.25000 0.000000 19910903 -0.007078

00036110 19910904 16.12500 -0.007692 19910904 -0.005305

00036110 19910905 16.00000 -0.007752 19910905 -0.002552

00036110 19910906 15.87500 -0.007813 19910906 0.000168

00036110 19910909 15.62500 -0.015748 19910909 -0.001440

00036110 19910910 14.87500 -0.048000 19910910 -0.009649

00036110 19910911 15.25000 0.025210 19910911 0.001137

00036110 19910912 15.37500 0.008197 19910912 0.005742

00036110 19910913 15.00000 -0.024390 19910913 -0.008531

00036110 19910916 14.62500 -0.025000 19910916 0.005064

00036110 19910917 14.62500 0.000000 19910917 -0.000335

00036110 19910918 14.50000 -0.008547 19910918 0.003058

00036110 19910919 14.12500 -0.025862 19910919 0.002537

00036110 19910920 14.12500 0.000000 19910920 0.001358

00036110 19910923 13.87500 -0.017699 19910923 -0.004231

00036110 19910924 13.87500 0.000000 19910924 0.004654

00036110 19910925 14.00000 0.009009 19910925 -0.001991

00036110 19910926 13.75000 -0.017857 19910926 -0.000003

00036110 19910927 13.75000 0.000000 19910927 -0.001109

00036110 19910930 13.75000 0.000000 19910930 0.005615

00036110 19911001 13.25000 -0.036364 19911001 0.002706

00036110 19911002 12.62500 -0.047170 19911002 -0.002055

00036110 19911003 12.87500 0.019802 19911003 -0.008514

00036110 19911004 12.87500 0.000000 19911004 -0.006485

00036110 19911007 13.00000 0.009709 19911007 -0.005285

00036110 19911008 13.00000 0.000000 19911008 0.002719

00036110 19911009 12.75000 -0.019231 19911009 -0.008587

00036110 19911010 12.50000 -0.019608 19911010 0.007487

00036110 19911011 12.50000 0.000000 19911011 0.002602

00036110 19911014 12.50000 0.000000 19911014 0.011762

00036110 19911015 13.25000 0.060000 19911015 0.011361

00036110 19911016 13.62500 0.028302 19911016 0.005888

00036110 19911017 14.00000 0.027523 19911017 -0.001440

00036110 19911018 14.25000 0.017857 19911018 0.001406

00036110 19911021 14.25000 0.000000 19911021 -0.005770

00036110 19911022 14.12500 -0.000351 19911022 -0.004453

00036110 19911023 14.12500 0.000000 19911023 -0.000243

00036110 19911024 13.87500 -0.017699 19911024 -0.007148

00036110 19911025 14.12500 0.018018 19911025 -0.002370

00036110 19911028 14.37500 0.017699 19911028 0.011968

00036110 19911029 14.37500 0.000000 19911029 0.005392

00036110 19911030 14.12500 -0.017391 19911030 0.004240

00036110 19911031 14.12500 0.000000 19911031 0.000997

00036110 19911101 14.25000 0.008850 19911101 -0.002554

00036110 19911104 14.25000 0.000000 19911104 -0.002500

00036110 19911105 14.00000 -0.017544 19911105 -0.002913

00036110 19911106 14.37500 0.026786 19911106 0.003014

00036110 19911107 14.50000 0.008696 19911107 0.008728

00036110 19911108 14.25000 -0.017241 19911108 -0.000403

00036110 19911111 14.00000 -0.017544 19911111 0.001141

00036110 19911112 14.12500 0.008929 19911112 0.008607

00036110 19911113 13.75000 -0.026549 19911113 0.001467

00036110 19911114 13.62500 -0.009091 19911114 -0.000726

00036110 19911115 13.25000 -0.027523 19911115 -0.032695

00036110 19911118 12.87500 -0.028302 19911118 0.004888

00036110 19911119 12.87500 0.000000 19911119 -0.014566

00036110 19911120 12.37500 -0.038835 19911120 -0.002176

00036110 19911121 12.62500 0.020202 19911121 0.003605

00036110 19911122 12.25000 -0.029703 19911122 -0.009545

00036110 19911125 12.25000 0.000000 19911125 -0.002468

00036110 19911126 12.25000 0.000000 19911126 0.005598

00036110 19911127 12.37500 0.010204 19911127 -0.002453

00036110 19911129 12.37500 0.000000 19911129 -0.001910

00036110 19911202 12.37500 0.000000 19911202 0.013456

00036110 19911203 12.25000 -0.010101 19911203 0.000236

00036110 19911204 12.12500 -0.010204 19911204 -0.002025

00036110 19911205 12.12500 0.000000 19911205 -0.005430

00036110 19911206 12.00000 -0.010309 19911206 0.003650

00036110 19911209 11.75000 -0.020833 19911209 -0.002028

00036110 19911210 11.50000 -0.021277 19911210 -0.001147

00036110 19911211 11.50000 0.000000 19911211 -0.001597

00036110 19911212 11.87500 0.032609 19911212 0.008769

00036110 19911213 12.00000 0.010526 19911213 0.006762

00036110 19911216 12.25000 0.020833 19911216 0.000967

00036110 19911217 11.50000 -0.061224 19911217 -0.004412

00036110 19911218 11.00000 -0.043478 19911218 0.001310

00036110 19911219 10.75000 -0.022727 19911219 -0.002997

00036110 19911220 10.87500 0.011628 19911220 0.010740

00036110 19911223 11.00000 0.011494 19911223 0.023195

00036110 19911224 11.25000 0.022727 19911224 0.007800

00036110 19911226 11.50000 0.022222 19911226 0.013319

00036110 19911227 11.62500 0.010870 19911227 0.005409

00036110 19911230 12.87500 0.107527 19911230 0.019729

00036110 19911231 13.50000 0.048544 19911231 0.005312

Many thanks for the help.

Best wishes.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

You can probably do it with three calls to proc Proc reg with a BY variable that is appropriately specified, one for quarter, semimonth and year.

You'll need to convert your date to a SAS date, and sort by date and then you can use a format to specify the intervals the regression.

for example for quarters:

ods table parameterestimates=quarterly estimates;

proc reg data=have;

by date;

model .....;

format date yyq6.;

run;

Start off by getting the regression code correctly specified and figuring out how to capture the output for the parameters, see sample above for quarters.

View solution in original post

6 REPLIES 6
Reeza
Super User

You can probably do it with three calls to proc Proc reg with a BY variable that is appropriately specified, one for quarter, semimonth and year.

You'll need to convert your date to a SAS date, and sort by date and then you can use a format to specify the intervals the regression.

for example for quarters:

ods table parameterestimates=quarterly estimates;

proc reg data=have;

by date;

model .....;

format date yyq6.;

run;

Start off by getting the regression code correctly specified and figuring out how to capture the output for the parameters, see sample above for quarters.

mexes
Calcite | Level 5

Hi Reeza

This code gives me the output in the results window, with all the graphs which I do not need and it takes a lot of time until the regression is finished because I have about 400 firms in my data set. I tried it with the command output out=want; but the regression does not work anymore. I need the slope coefficients in a table and next to slope coefficients the dates like 1990Q1 1990Q2 and so on. This means one slope coefficient for 1990Q1, one slope coefficient for 199Q2 and so on...

Thanks for your help

Reeza
Super User

Did you check the output in the quarterly_estimates file? I accidently left a space in the name but if you add an underscore it should produce a dataset called quarterly estimates with the by variables included. you can also restrict the output to the results viewer, using ODS Select or you can even close the listing destination totally so you have no output.

The speed is limited by how fast your computer is. 

ods listing close;

*or;

*ods select parameterestimates;

ods table parameterestimates=quarterly_estimates;

proc reg data=have;

by date;

model .....;

format date yyq6.;

run;

ods listing;

mexes
Calcite | Level 5

I checked the quarterly_estimates file. Now it works,great. Do you know a suitable sas date format for half year intervals? I found the format year6. for the yearly interval.

Thanky for your help.

Reeza
Super User

No I don't. Do you have SAS 9.3?

If so you can create your own function in terms of a format and apply that.
If you have 9.2 then you could hardcode the format if you knew the range of years, but it would allow you to have similar code.

mexes
Calcite | Level 5

Hi Reeza

I have SAS 9.3. I created my own function, now the last problem is also solved!Thank you very much for your help!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 1517 views
  • 0 likes
  • 2 in conversation