BookmarkSubscribeRSS Feed
fcferreira
Calcite | Level 5

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!

 

 

 

5 REPLIES 5
Reeza
Super User

PROC REG needs a QUIT.

 

Add the QUIT statement and it should 'end'.

ballardw
Super User

@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.

fcferreira
Calcite | Level 5

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

 

WarrenKuhfeld
Rhodochrosite | Level 12

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.

Ksharp
Super User

Did you try  PROC HPREG ?

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!

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.

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
  • 5 replies
  • 3431 views
  • 4 likes
  • 5 in conversation