Hi, From an I/O perspective, which of these is faster, this:

DATA my_subset;
   SET my_giant_superset (WHERE=(some_filter = 1));
RUN;

Or this:

DATA my_subset;
    SET my_giant_superset;

    WHERE some_filter = 1;
RUN;

I think it would be the first one, but I'm not sure. I tried looking in some lower-level SAS I/O documentation but couldn't find the answer there.

Any help is greatly appreciated - thanks!

asked 11 Jan '12, 11:03

sparc_spread's gravatar image

sparc_spread
134
accept rate: 0%

edited 11 Jan '12, 11:04


I'm not aware of any difference in performance between the two, and running some simple tests doesn't turn up any differences

The biggest argument I can think of is that using the where option tends to lead to easier to read code, especially if there are multiple set statements involved:

data a; 
do i = 1 to 10;
output;
end;
run;

data b;
    do i = 5 to 15;
    output;
    end;
run;

data c;
    set a; output;
    set b; output;
    where i > 6;
run;

It's not obvious at a glance (at least to me) what the contents of set c are likely to be!

Note that: http://www2.sas.com/proceedings/sugi30/002-30.pdf suggests that there's a minor performance benefit to using the statement instead of the option, but I'm hesitant to take precision performance data from a paper written for an older version of the software.

link

answered 18 Jan '12, 10:29

WilliamDobson's gravatar image

WilliamDobson
567113
accept rate: 36%

Thanks! I agree with you re both readability and the SUGI paper.

(18 Jan '12, 11:03) sparc_spread
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×12
×7

Asked: 11 Jan '12, 11:03

Seen: 1,661 times

Last updated: 18 Jan '12, 11:03

powered by OSQA