| Date: | Mon, 28 Jul 2003 15:33:26 -0400 |
| Reply-To: | "Chen, Jian" <ozz6@CDC.GOV> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "Chen, Jian" <ozz6@CDC.GOV> |
| Subject: | Re: merge data |
| Content-Type: | text/plain |
|---|
Code below also works:
Data step1;
length descr $ 40;
if first.id then descr="";
Merge set1(in=a) set2(in=b);
By id;
If a and b ;
run ;
-----Original Message-----
From: Mai To [mailto:Mai.To@UTH.TMC.EDU]
Sent: Monday, July 28, 2003 1:50 PM
To:
Subject: merge data
I have two datasets:
Set1:
ID DESCR
001 Cost of moving PCs from etc...
002 Move the switch boxes
Set2:
ID LINE AMT
001 01 50.00
001 02 (50.00)
002 01 (100.00)
002 02 80.00
002 03 20.00
What I would like to have is
001 01 50.00 Cost of moving PCs from etc...
001 02 (50.00)
002 01 (100.00) Move the switch boxes
002 02 80.00
002 03 20.00
I used this stmt for merge:
Data step1;
Merge set1(in=a) set2(in=b);
By id;
If a and b:
Proc sort data=step1;
By ID;
And this is the result:
ID LINE AMT DESCR
001 01 50.00 Cost of moving PCs from etc...
001 02 (50.00) Cost of moving PCs from etc...
002 01 (100.00) Move the switch boxes
002 02 80.00 Move the switch boxes
002 03 20.00 Move the switch boxes
What can I do to have the DESCR just print on the first line?
Thanks.
Mia
|