Date: Mon, 4 Apr 2011 14:17:18 +0000
Reply-To: "DUELL, BOB (ATTCINW)" <bd9439@ATT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "DUELL, BOB (ATTCINW)" <bd9439@ATT.COM>
Subject: Re: Reformatting prior to merge
In-Reply-To: <SNT111-W580D66C6A8E00372E8FB0893A30@phx.gbl>
Content-Type: text/plain; charset="us-ascii"
If you really want to change the format and character variable length, you can use PROC SQL and MODIFY statements. To make them "match" you only need to modify your dataset "B", changing the format of one variable and the length of another:
proc sql;
alter table b
modify QLGA num format=2.
modify PAYNUM char(6);
quit;
Note that you cannot change the "length" of a numeric variable with PROC SQL (at least that's what the doc says, I've never tried). If you reduce the length of a character variable, values are "truncated". Also be aware that if you change the length of a variable the entire data set must be re-written! That could take a significant amount of time and disk space depending on how large your table is.
Good luck,
Bob
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Laughing Beggar
Sent: Sunday, April 03, 2011 11:10 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Reformatting prior to merge
Hi all,
I want to merge two datasets.
They have the same variables but:
1/ In dataset "A" variable "QLGA" is formatted as numeric 2. and in dataset "B" its formatted as numeric 1. (they have the same length).
2/ In dataset "A" variable "PAYNUM" is formatted as character $6. and in dataset "B" its formatted as character $3. (they have respective lengths of 6 and 3).
How do I get the formats and lengths to match across datasets before I try to merge them?.
Thanks
L_B
SAS 9.2 WINXP
|