```Date: Tue, 4 Dec 2001 13:48:58 -0500 Reply-To: Sigurd Hermansen Sender: "SAS(r) Discussion" From: Sigurd Hermansen Subject: Re: Cartesian product Guess that I lost sight of the original question when I wrote the earlier response. I should have said that your SQL program declares an "equijoin", not a Cartesian product. An equijoin works like an ... INNER JOIN ... ON ... Data steps that approximate the Cartesian product and other SQL JOIN's become very complex, as prior examples provided by Francis Harvey, Quentin McMullen, and Rob Workman show. Besides, why would anyone go to the trouble of trying to replicate, for example, a Cartesian product in a data step. That would involve much the same level of wasted effort as using a team of master carpenters to build a house that looks prefab. Why not just write: proc sql; create view Carteasevw as select ..... from A,AA ; quit; data Cartease; set Carteasevw; run; I see no need to make a lot of artificial distinctions among different ways of declaring operations in relational algebra to a compiler. Sig On Tue, 4 Dec 2001 11:42:04 -0500, Sigurd Hermansen wrote: >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 wrote: > >>Hi , >> >>How do I create the Cartesian product that I get from the program below >>using datastep in stead of sql ? >> ```

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