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 (November 2006, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 10 Nov 2006 12:36:09 -0500
Reply-To:   "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject:   Re: Merging Datasets

On Thu, 9 Nov 2006 11:02:09 -0500, Steven Lolay <stevenlolay@IF.COM> wrote:

>Hi > >Is it possible for you to produce a datset which has 2 records for each >category ie a Y and No with the code below: > >DATA dummy_1; >INPUT match 1. cat $20.; > >DATALINES; >1Fixed >1Tracker >1Offset not Active >1Offset Active >run; >proc sort data=dummy_1;by match;;run; > > >DATA dummy_2; >INPUT match 1. erc $1.; >DATALINES; >1N >1Y >run; >proc sort data=dummy_2;by match;run; > > >data dummy; > >merge dummy_1 dummy_2; > >by match; > >run; > > >I think it's called a cartesian join but could be wrong!!! > >Could you please tick the box to send me a reply as in a rush. > >Thanks

It's done most easily with SQL, and unless you really have additional groups you do not need the MATCH columns.

DATA dummy_1; INPUT cat $20.; DATALINES; Fixed Tracker Offset not Active Offset Active ;

DATA dummy_2; INPUT erc : $1.; DATALINES; N Y ;

proc sql;

create table dummy as select * from dummy_1 cross join dummy_2 order by cat, erc desc;

quit;

Result:

cat erc

Fixed Y Fixed N Offset Active Y Offset Active N Offset not Active Y Offset not Active N Tracker Y Tracker N


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