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!
PROC REG needs a QUIT.
Add the QUIT statement and it should 'end'.
@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.
Thank you! It helped a lot and indeed, it is much faster now.
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.
Did you try PROC HPREG ?
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.