Date: Wed, 18 Feb 2004 15:16:33 -0500
Reply-To: Kerri Rivers <kerrir@PRB.ORG>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Kerri Rivers <kerrir@PRB.ORG>
Subject: Re: subtracting one dataset from another
Content-Type: text/plain; charset="iso-8859-1"
thank you so much, chuck. that's fantastic. i really appreciate the help.
i never would have thought to negate the values in my city dataset.
have a good one,
~kerri
-----Original Message-----
From: SAS(r) Discussion
To: SAS-L@LISTSERV.UGA.EDU
Sent: 2/18/2004 3:13 PM
Subject: Re: subtracting one dataset from another
Kerri,
Howard is quite correct - just wasn't thinking - arrays would be better
than a macro -
Try this -
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;
array numvars (*) v1-v4;
do i = 1 to dim(numvars);
numvars(i) = -numvars(i);
end;
drop i;
cards;
0040 16000 11000 7300 3500
0060 37000 18700 6900 2750
;
data suburb;
set metro city;
run;
proc summary data=suburb nway missing;
classes msacmsa;
var _numeric_;
output out=suburb (drop=_type_ _freq_)
sum=;
run;
proc print; run;
HTH,
Charles Patridge