Date: Fri, 13 Jun 2008 07:46:45 -0400
Reply-To: Muthia Kachirayan <muthia.kachirayan@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Muthia Kachirayan <muthia.kachirayan@GMAIL.COM>
Subject: Re: Keep records with a specific number of digits
In-Reply-To: <f9b7f0c6-c251-44ff-9fa9-34dc838e7c7d@26g2000hsk.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
On Fri, Jun 13, 2008 at 7:17 AM, <ledaniels7@gmail.com> wrote:
> What if they are not all numeric? Some have a mix with characters as
> well...
Then you treat as character variable. Take 4 positions. See example. Y
is declared as a string of 4 characters. The assignment Y = X retains first
4 non-blank characters. Note FIRST 4.
data have;
input x $;
cards;
1234
2345
87 654
78
;
run;
data have1;
length y $4;
set have;
y = x;
run;
proc print data = have1;
run;
proc contents data = have1;
run;
|