Date: Thu, 30 Sep 2004 11:53:03 +0200
Reply-To: Robert Bardos <bardos2@ANSYS.CH>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Robert Bardos <bardos2@ANSYS.CH>
Subject: Re: Combining data with different length of fields
In-Reply-To: <3049296b.0409291436.23500cb4@posting.google.com>
Content-Type: text/plain; charset="iso-8859-1"
Tony,
as given I could not reproduce your problem, ie. using the length statement
ahead of set should do. As soon as I inserted a "format plan $6. mbrid $5."
statement in the step creating data1 the problem was there. So it is a
display/format problem rather than a length problem that you have to solve.
Hope this helps
Robert Bardos
Ansys AG, Switzerland
-----Ursprüngliche Nachricht-----
Von: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU]Im Auftrag von
Tony Wang
Gesendet: Donnerstag, 30. September 2004 00:37
An: SAS-L@LISTSERV.UGA.EDU
Betreff: Combining data with different length of fields
Hi All,
I have several datasets with variables like "plan","mbrid" etc. They
have different length ($6-$25).
plan mbrid
data1 'bcbswa' 'xxxxx'
data2 'wellpoint' 'xxxxxxxxxx'
When I combine them like this:
data allplan;
length plan $ 50 mbrid $50;
set data1 data2;
run;
Output:
plan mbrid
bcbswa xxxxx
wellpo xxxxx
It cut off something in the 2nd dataset. I tried to define the length
of data1
and data2 seperately but it didn't work either. At last I changed the
sequence of data sets like "set data2 data1;" It worked.
Is there an alternative way to avoid losing information when combining
datasets?
I have tens of datasets and hundreds of fields. I am not supposed to
count the maximum length of each field.
Thanks for your help,
Tony