Date: Wed, 18 Feb 2004 14:18:20 -0500
Reply-To: Kerri Rivers <kerrir@PRB.ORG>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Kerri Rivers <kerrir@PRB.ORG>
Subject: subtracting one dataset from another
Content-Type: text/plain; charset="iso-8859-1"
hi all,
i have 2 datasets (METRO and CITY) with an equal number of records (one for
each metro area) and the same variables. i need to subtract city from metro
to get "SUBURB." the only way i can think of to do this is by renaming all
of the variables in one dataset, merging the 2 datasets together, and then
subtracting. since i have 5000 variables, that woudl be cumbersome at best.
is there an easier way to do this?
for example:
/*here's an example of what i have*/
DATA METRO;
input msacmsa v1 v2 v3 v4;
cards;
0040 20000 15000 10000 5000
0060 40000 20000 8000 3500
;
DATA CITY;
input msacmsa v1 v2 v3 v4;
cards;
0040 16000 11000 7300 3500
0060 37000 18700 6900 2750
;
/*here's an example of what i want to get*/
DATA SUBURB;
input msacmsa v1 v2 v3 v4;
cards;
0040 4000 4000 2700 1500
0060 3000 1300 1100 750
;
my SQL skills are pretty basic, but i am using it periodically. i'm slowly
becoming a convert. ;)
thanks for any help/suggestions/advice/etc.
~kerri