BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
whymath
Lapis Lazuli | Level 10

I am learning to write PROC DS2, some materials says there is a threads= option, which enables SAS use multiple threads to run program, so SAS can run faster. I write the following program:

data test1;
  set sashelp.class;
  do i=1 to 3e6;
    output;
  end;
run;

*Normal data step;
data test2;
  set test1;
  sum_age+age;
run;

proc delete data=test2;
run;

*Data step in DS2, without multiple threads;
proc ds2;
  data test3/overwrite=yes;
    method run();
      dcl int sum_age;
      set test1;
      sum_age+age;
    end;
  enddata;
  run;
quit;

proc delete data=test3;
run;

*Data step in DS2, with multiple threads;
proc ds2;
  thread t/overwrite=yes;
    method run();
    dcl int sum_age;
    set test1;
    sum_age+age;
    end;
  endthread;
  run;

  data test4/overwrite=yes;
    dcl thread t t_instance;
    method run();
      set from t_instance threads=8;
    end;
  enddata;
  run;
quit;

Well, I just can't understand the running time:

Normal data step
real time: 2.97 seconds
cpu time: 2.87 seconds

Data step in DS2, without multiple threads
real time: 6.83 seconds
cpu time: 8.06 seconds

Data step in DS2, with multiple threads
real time: 4.47 seconds
cpu time: 13.26 seconds

And I write proc delete before taking each test, to keep the WORK library clean. My questions are:

1. Why data step in ds2 without multiple threads costs much time than normal data step?

2. Why data step in ds2 with multiple threads  costs much time than normal data step? Even I let threads=16, there is not significant difference on real time.

1 ACCEPTED SOLUTION

Accepted Solutions
AhmedAl_Attar
Ammonite | Level 13

Hi @whymath 

 

Check out this paper "User-Defined Multithreading with the SAS® DS2 Procedure: Performance Testing DS2 Against Functionall..."

by Troy Martin Hughes 

He does an excellent job in explaining what you are observing.

 

Hope this helps,

Ahmed

View solution in original post

1 REPLY 1
AhmedAl_Attar
Ammonite | Level 13

Hi @whymath 

 

Check out this paper "User-Defined Multithreading with the SAS® DS2 Procedure: Performance Testing DS2 Against Functionall..."

by Troy Martin Hughes 

He does an excellent job in explaining what you are observing.

 

Hope this helps,

Ahmed

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 766 views
  • 2 likes
  • 2 in conversation