BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Sinistrum
Quartz | Level 8

Dear community,

 

I would be glad, if you could help me with the following performance issue.

My question is, if it were more favourable, to run the "proc model procedure" on multiple small data sets separately or to run it on a big data set, containing all the small data sets "stack" (i.e., via data statement) und run "proc model" with a "by" statement.

 

The scenario is the following:
I run the first simulation-loop to generate a data set, run five regressions, store the parameter estimates.

I run the second simulation-loop to generate a date set, run five regressions, store the parameter estimates.

...

 

My idea is the following:
I would like to run all simulation loops in a row, get, e.g., 5000 data sets, each with a indicator-variable (e.g. "simit") equal to the number of iteration. Then, I stag all the data sets via a data statement. In the following, I run only 5 proc model with "by simit" instead of

5 * 5000 = 25000

times proc model.

My question is, if this procedure were more efficient.

One the one hand, I do have to evoke the procedure less often, on the other hand, the data set with the by-statement might be huge.

 

I would be glad, if you would answer me, for I am sue, it would help me to learn, how programs are generally written more efficiently.

 

Yours sincerely,

Mario

1 ACCEPTED SOLUTION

Accepted Solutions
sinmathstat
Fluorite | Level 6

I usually go with "BY" processing. "BY" processing is fast and efficient specially if you don't need to sort your data set.

 

 

View solution in original post

2 REPLIES 2
sinmathstat
Fluorite | Level 6

I usually go with "BY" processing. "BY" processing is fast and efficient specially if you don't need to sort your data set.

 

 

Sinistrum
Quartz | Level 8

Hello

 

and thank you for your reply.

 

After reading your post, I tried to rewrite the simulation.

From former 144 minutes, I have come down to 23 minutes.

 

The proc model with by took

real time           20.00 seconds
cpu time            19.92 seconds

which means, that it  does not work the way I have feared.

 

There are 5000 loops, which has meant 5000*~0,2 seconds = 1000 seconds = 16 2/3 minutes to achieve the same result with 5000 proc model statements.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2 replies
  • 853 views
  • 2 likes
  • 2 in conversation