turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- Re: Proc reg is taking too long!

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

09-29-2017 04:26 PM

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!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to fcferreira

09-29-2017 05:31 PM

PROC REG needs a QUIT.

Add the QUIT statement and it should 'end'.

Highlighted
## Re: Proc reg is taking too long!

Options

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to fcferreira

09-29-2017 06:46 PM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to ballardw

09-30-2017 08:23 AM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to fcferreira

09-30-2017 03:06 PM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to fcferreira

09-30-2017 11:13 AM

Did you try PROC HPREG ?