Date: Mon, 4 Mar 2002 09:03:30 -0500
Reply-To: "Tift, Brian" <bet5@CDC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Tift, Brian" <bet5@CDC.GOV>
Subject: Re: Doing a SQL from two datasets
Content-Type: text/plain
Poul,
Use a UNION Select to put two tables into one using SQL. You need to be
sure that you have
the same variables in you select statements or you may get an error. This
example should work:
-----Original Message-----
From: poulravn1@HOTMAIL.COM [mailto:poulravn1@HOTMAIL.COM]
Sent: Monday, March 04, 2002 8:34 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Doing a SQL from two datasets
Hi there,
I need to do the same sql on two datasets with the same variables but
covering different time periods.
How can I write the 'select' statement so that it will gather data from both
datasets?
I.e. (of course much more complicated in practice):
data one;
infile cards;
input date x y;
cards;
1feb02 1 1
2feb02 2 2
25feb02 25 25
;
data two;
infile cards;
input date x y;
cards;
1mar02 4 5
2mar02 7 9
25mar02 1 10
;
proc sql;
create table three as select . . . . from ???
run;
Thanks in advance
Poul Ravn Sorensen
|