On Tue, 11 Mar 2008 15:59:29 -0700, Peter <crawfordsoftware@GMAIL.COM> wrote:
>On Mar 11, 10:01 pm, Ruve <band...@gmail.com> wrote:
>> In the following data step example, dataset a is read only once to
>> create the three sub-datasets (a1, a2, a3). How to implement this in
>> Proc SQL without efficiency sacrifice? Thanks!
>> data a;
>> input x;
>> data a1 a2 a3;
>> set a;
>> if x=1 then output a1;
>> else if x=2 then output a2;
>> else output a3;
>Why not use the datastep? Why require sql ?
Why? Suppose that the source is not the existing data set A, but rather some
process which is most advantageously implemented in SQL. What Ruve wants to
do is not possible, but the next best thing is to wrap a CREATE VIEW AS
around the SQL query, and include X as one of the columns (probably
populating it by means of a CASE expression). Then run the splitter DATA
step against the view.