Date: Wed, 27 Sep 2006 23:39:50 -0400
Reply-To: Ya Huang <ya.huang@AMYLIN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ya Huang <ya.huang@AMYLIN.COM>
Subject: Re: Simple Reshape Question?
proc transpose data=data2 out=tran2 (drop=_name_);
by city;
id animal;
var total;
run;
data final;
merge data1 tran2;
by city;
run;
If you are not happy for the missing and want 0 instead, you
need to reset them in the final data step.
On Wed, 27 Sep 2006 20:12:49 -0700, sak071 <samuelkleiner@GMAIL.COM> wrote:
>Hi everyone,
>I have a quick question about how to reshape the following dataset,
>data1 and data2 into a final dataset called final. The simple example
>is below. Any help would be greatly appreciated. Thanks!
>
>-sak
>
>/*I NEED HELP WITH THE FOLLOWING PROBLEM. I HAVE THE FOLLOWING 2
>DATASETS:*/
>
>DATA DATA1;
> INPUT city dogs cats;
>CARDS;
>1 5 4
>2 7 2
>3 8 6
>;
>
>DATA DATA2;
>length animal $ 10;
> INPUT city animal total;
>CARDS;
>1 elephants 4
>1 goats 7
>1 iguanas 1
>2 goats 2
>3 elephants 9
>3 iguanas 6
>;
>
>/*I NEED THE FINAL DATASET TO LOOK AS FOLLOWS*/
>DATA FINAL;
> INPUT city dogs cats elephants goats iguanas;
>CARDS;
>1 5 4 4 7 1
>2 7 2 0 2 0
>3 8 6 9 0 6
>;
|