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

Dear Gurus,

 

I have a dataset contains 21 million observations with 1500 variables.

I just want to make sum of 500 variables using two index variables. (say, product_code and date). 

 

I still can finish the manipulation by using proc means by spending 30 minutes but just wondering 

if any of you experienced proc sql with group by can be faster or not?

I read some of articles about proc means vs proc sql but not very sure for the big data with many numbers of variables.

By the way, the data set is native SAS dataset and not coming from Oracle or any other database.

 

Any opinion from will be appreciated.

Thank you,

Kaz

1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

Whatever procedure you're using it will have to read the data and to sort the data for summing by groups.

 

Both Proc SQL and Proc Means are thread-enabled.

http://support.sas.com/documentation/cdl/en/lrcon/69852/HTML/default/viewer.htm#n0czb9vxe72693n1lom0...

 

I don't expect Proc SQL to outperform Proc Means for this task.

 

What you probably want to do is to ensure that multi-threading can get used where possible (=options set to allow for multi-threading).

 

I would expect this process to be I/O bound so what certainly will impact on performance is how your SAS WORK and UTILLOC area (used for sorting) are set up (but that's something only an admin can change).

View solution in original post

6 REPLIES 6
Patrick
Opal | Level 21

Whatever procedure you're using it will have to read the data and to sort the data for summing by groups.

 

Both Proc SQL and Proc Means are thread-enabled.

http://support.sas.com/documentation/cdl/en/lrcon/69852/HTML/default/viewer.htm#n0czb9vxe72693n1lom0...

 

I don't expect Proc SQL to outperform Proc Means for this task.

 

What you probably want to do is to ensure that multi-threading can get used where possible (=options set to allow for multi-threading).

 

I would expect this process to be I/O bound so what certainly will impact on performance is how your SAS WORK and UTILLOC area (used for sorting) are set up (but that's something only an admin can change).

k_shide
Obsidian | Level 7

Patrick,

 

thanks very much for your quick reply.

I read through and found the right key word for the option.

also thanks for not wasting time for replacing codes by proc sql still taking around 30 minutes.

 

Kaz

 

Patrick
Opal | Level 21

30 minutes doesn't feel that bad for the volumes you're dealing with: 8 Bytes for a numeric variable * 500 variables * 21M rows add up to more than 78GB.

 

I'd expect the main bottleneck to be I/O which is nothing you can do much about it except to reduce volumes as fast as you can and to minimize passes through the data while the volumes are high.

k_shide
Obsidian | Level 7

Yes. It's not bad at all.

Recently many guys says Python Python Python everyday and off course I used it for certain purposes but 

for big data manipulations like this, I think SAS still holds significatn advantage to other languages.

Together with macro facility, it allows so much freedom.

 

Thanks anyway, 

Kaz

Ksharp
Super User

Add some options to fast your code.

option  bufno=100 bufsize=128k  cpucount=12 threads;

 

 

You also could try PROC TABULATE.

@Chris_NewZ claim PROC TABULATE is faster than MEANS or SQL at somewhere.

 

ods select none;
proc tabulate data=sashelp.class out=want ;
var age weight height;
table (age weight height)*sum;
run;
ods select all;

 

 

 

k_shide
Obsidian | Level 7

Thank you for the parameter setting and 

I totally forgot tabulate procedure which more flexible functions than means.

 

Kaz

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!

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.

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
  • 6 replies
  • 3182 views
  • 2 likes
  • 3 in conversation