LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 2001, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 4 Dec 2001 11:34:23 -0600
Reply-To:     "Workman, Rob" <Rob.Workman@SULZERCARBOMEDICS.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Workman, Rob" <Rob.Workman@SULZERCARBOMEDICS.COM>
Subject:      Re: Cartesian product
Comments: To: CAFO <cafo@INT.TELE.DK>
Content-Type: text/plain; charset="iso-8859-1"

If there is an index on 'B' this code should work. As a side note, this further demonstrates the problem with key= that Ian was describing in a previous message. Namely that the index pointer is not reset to the top of the index unless the key value changes between calls to the set/key= statement.

Kind regards,

Rob Workman

data a; length b $10; a=1; b='BO'; output; a=2; b='BO'; output; a=3; b='IB'; output; a=4; b='MY'; output; a=5; b='MY'; output; run;

data aa (index=(b)); length b $10; aa=1; b='BO'; output; aa=2; b='BO'; output; aa=3; b='IB'; output; aa=51; b='MY'; output; aa=52; b='MY'; output; aa=53; b='MY'; output; aa=54; b='MY'; output; run;

data ll; set a; do while (1); link setstmt; if _iorc_ ne %sysrc(_sok) then leave; output; end; b = '00'x; link setstmt; _error_=0; return;

setstmt: set aa key = b; run;

-----Original Message----- From: CAFO [mailto:cafo@INT.TELE.DK] Sent: Tuesday, December 04, 2001 9:09 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Cartesian product

Hi ,

How do I create the Cartesian product that I get from the program below using datastep in stead of sql ?

data a;

length b $10;

a=1; b='BO'; output;

a=2; b='BO'; output;

a=3; b='IB'; output;

a=4; b='MY'; output;

a=5; b='MY'; output;

run;

data aa;

length b $10;

aa=1; b='BO'; output;

aa=2; b='BO'; output;

aa=3; b='IB'; output;

aa=51; b='MY'; output;

aa=52; b='MY'; output;

aa=53; b='MY'; output;

aa=54; b='MY'; output;

run;

proc sql;

create table kk as

select *

from a, aa

where a.b=aa.b;

quit;

proc sort;

by b a aa;

run;


Back to: Top of message | Previous page | Main SAS-L page