Date: Tue, 25 Nov 2008 11:30:56 -0800
Reply-To: "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Subject: Re: how do I run this in Proc SQL
In-Reply-To: <gghigc$orf$1@news.motzarella.org>
Content-Type: text/plain; charset=iso-8859-1
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On
> Behalf Of morfar
> Sent: Tuesday, November 25, 2008 11:09 AM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: how do I run this in Proc SQL
>
> is there an easy way to run this and not end up with
> duplicate rows, which
> then have to be separately deduped?
>
> the goal is to get all new and different items from "Data b"
> without losing
> the data from "Data a"
>
> data a;
> input c1 $ p2 $ d3 $ e4 $;datalines;
> 1001 601 010108 A1
> 1001 501 020108 B1
> 1001 401 030108 C1
> ;;;;
> run;
> data b;
> input c1 $ p2 $ d3 $ e4 $;datalines;
> 1001 601 010108 A1
> 1001 501 020108 B1
> 1001 401 030108 C1
> 1001 301 010108 A1
> 1001 201 020108 T2
> 1001 101 030108 XX
> 1001 901 030108 XX
> ;;;;
> run;
> proc sql;create table joined as select a.*,b.*
> from a a full join b b
> on a.c1 = b.c1
> order b.p2, b.d3;
> quit;
>
Does this get what you want?
proc sql;
create table c as
select * from a
union
select * from b
;
quit;
Hope this is helpful,
Dan
Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204
|