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:42:04 -0500
Reply-To:     Sigurd Hermansen <hermans1@WESTAT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Sigurd Hermansen <hermans1@WESTAT.COM>
Subject:      Re: Cartesian product
Comments: To: cafo@INT.TELE.DK

Try: proc sql; create table kk as select * from a, aa /* Omitting the constraint on the equijoin declares the Cartesian product. where a.b=aa.b; */ quit;

To verify that you have a Cartesian product of the linked keys, multiply five (the number of unique values of a.a) by seven (the number of unique values of aa.aa). That product must equal the number of rows in the yield of the query, kk. Sig

On Tue, 4 Dec 2001 16:09:24 +0100, CAFO <cafo@INT.TELE.DK> wrote:

>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