Help using Base SAS procedures

Proc reg is taking too long!

Reply
New Contributor
Posts: 2

Proc reg is taking too long!

Hi all,

 

I've been running proc reg (SAS 9.4) for my dataset below and it has been taking (so far) 9 hours! I just run proc reg for other variables of my same dataset and it took 3 hours... what can be wrong? (Btw, I need the outputs datasets to continue with my calculations!.

 

Data structure: 

 

data:

 

data residual;

input state herdcode cowindex calvdat residual sint cost;

datalines;

 

FL 58210029 345 02/17/2010 34 0.39 0.92

;

run;

 

 

 

Proc Reg:


proc reg data = residual;
by state herdcode cowindex calvdat;
model woodsresid = sint cost;
output out=reg_resid
p=residhat
r=res_resid;
ods output ParameterEstimates = par_resid;
run;

 

 

The only categorical variable in my dataset is state.sint and cost are the values of sine and cosine, respectivelly, for the numbers 1 to 365. I have 7,000,266 rows in my dataset, and approximatelly 900,000 combinations of by group.

 

Can someone give an advice on how I can be more efficient in this code ? I still have 4 more variables to model!

 

Thanks!

 

 

 

Super User
Posts: 21,456

Re: Proc reg is taking too long!

Posted in reply to fcferreira

PROC REG needs a QUIT.

 

Add the QUIT statement and it should 'end'.

Highlighted
Super User
Posts: 12,148

Re: Proc reg is taking too long!

Posted in reply to fcferreira

fcferreira wrote:

Hi all,

 

I've been running proc reg (SAS 9.4) for my dataset below and it has been taking (so far) 9 hours! I just run proc reg for other variables of my same dataset and it took 3 hours... what can be wrong? (Btw, I need the outputs datasets to continue with my calculations!.

 

Data structure: 

 

data:

 

data residual;

input state herdcode cowindex calvdat residual sint cost;

datalines;

 

FL 58210029 345 02/17/2010 34 0.39 0.92

;

run;

 

 

 

 

 

The only categorical variable in my dataset is state.sint and cost are the values of sine and cosine, respectivelly, for the numbers 1 to 365. I have 7,000,266 rows in my dataset, and approximatelly 900,000 combinations of by group.

 

Can someone give an advice on how I can be more efficient in this code ? I still have 4 more variables to model!

 

Thanks!


Part of the issue could also be generating 900,000 sets of output for the results window. You might consider using the proc reg output options such as the OUTEST output dataset to capture parameters instead of ODS OUTPUT on the procedure statement with NOPRINT option.

New Contributor
Posts: 2

Re: Proc reg is taking too long!

Thank you! It helped a lot and indeed, it is much faster now.

 

SAS Super FREQ
Posts: 466

Re: Proc reg is taking too long!

Posted in reply to fcferreira

Adding a quit statement is indeed the correct answer.  However, it does not make the procedure run any faster.  REG is an interactive procedure.  It finishes your step and waits for the next model or other statement or a quit statement.  The quit statement or the next proc or data step ends the procedure, but that can't happen until the step finishes running.

Super User
Posts: 10,312

Re: Proc reg is taking too long!

Posted in reply to fcferreira

Did you try  PROC HPREG ?

Ask a Question
Discussion stats
  • 5 replies
  • 447 views
  • 4 likes
  • 5 in conversation