Programming the statistical procedures from SAS

PROC REG code efficiency

Accepted Solution Solved
Reply
Contributor
Posts: 58
Accepted Solution

PROC REG code efficiency

[ Edited ]

Hello guys i am using following codes but these are not working well as they are not efficient and taking too long.  can someone help me with more efficient codes which can sever the saem puppose. thanks

 

proc reg data=US2 outest=period94_97 edf;
where datadate between '31JAN1991'd and '31DEC1993'd;
model ret= retm;
by conm; run; quit;


Accepted Solutions
Solution
‎11-01-2016 10:04 PM
SAS Super FREQ
Posts: 3,538

Re: PROC REG code efficiency

If you are doing this in a non-batch environment, then ODS graphics is on. If the BY variable has many levels, then most of the time is spent creating/printing tables and graphics. 

 

Yes, the PROC REG statement supports a NOPRINT option. 

If you want only want parameter estimates, and related statistics, use the OUTEST= option as you are doing.

If you want also want predicted values and residuals, you can use the OUTPUT statement.

 

I suggest 

 

proc reg data=US2 outest=period94_97 edf NOPRINT;
where datadate between '31JAN1991'd and '31DEC1993'd;
model ret= retm; 
by conm;
quit;

You can read about the NOPRINT option and other ways to suppress ODS in SAS.

 

 

View solution in original post


All Replies
Super User
Posts: 18,498

Re: SAS codes efficiency issue

Define not working. 

Contributor
Posts: 58

Re: SAS codes efficiency issue

it continue to show that it is doing something for hours. i waited more than hour but nothing came up. is there any way to do it simply or putting something like noprint so that it just create the tables in libray and not the graphes and other in print window. 
thanks 

Super User
Posts: 7,092

Re: SAS codes efficiency issue

First of all, reduce your dataset size until you get it working in a reasonable timespan. Then you can use options fullstimer to get a feel for the problem.

Could you provide some info about your SAS machine (CPU, memory, storage setup)

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super User
Posts: 18,498

Re: SAS codes efficiency issue

How big is your data? 

 

Look at ODS SELECT to limit the output. 

Solution
‎11-01-2016 10:04 PM
SAS Super FREQ
Posts: 3,538

Re: PROC REG code efficiency

If you are doing this in a non-batch environment, then ODS graphics is on. If the BY variable has many levels, then most of the time is spent creating/printing tables and graphics. 

 

Yes, the PROC REG statement supports a NOPRINT option. 

If you want only want parameter estimates, and related statistics, use the OUTEST= option as you are doing.

If you want also want predicted values and residuals, you can use the OUTPUT statement.

 

I suggest 

 

proc reg data=US2 outest=period94_97 edf NOPRINT;
where datadate between '31JAN1991'd and '31DEC1993'd;
model ret= retm; 
by conm;
quit;

You can read about the NOPRINT option and other ways to suppress ODS in SAS.

 

 

Contributor
Posts: 58

Re: PROC REG code efficiency

Dear i tried this nonprint option as you wrote but it took almost the same time. how can i stop all the graphics ? 

 

SAS Super FREQ
Posts: 3,538

Re: PROC REG code efficiency

As it says in the article that I linked to, the NOPRINT option also suppresses the graphics. When you use the NOPRINT option, you should see no output of any kind.

 

With only one regressor, this PROC REG statement should be very fast. Please answer the following questions:

  1. Are there any NOTES or WARNINGs in the SAS log?
  2. How many distinct levels of the BY variable are being used?  
  3. Is the PROC REG code that you showed the actual code that you are submitting, or are there additional options that you are not showing?
  4. How many observations are used? (= number of observations included by the WHERE clause)
Contributor
Posts: 58

Re: PROC REG code efficiency

there are no warnings or log reports on it becuase it remain busy as long as i see for more than hours,

my whole date has about 387323 observaton for 20 years current where statement includes only 3 years,

i am using the same codes as i shown you 

by variable is company names and there are more than 1000 companies. 

 

Contributor
Posts: 58

Re: PROC REG code efficiency

Thank you very much i just realized that i was using run after quit; get rid of that and it worked with noprint. thinks again
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 9 replies
  • 409 views
  • 0 likes
  • 4 in conversation