Date: Sun, 24 Jul 2005 11:22:27 -0400
Reply-To: Arthur Tabachneck <art297@NETSCAPE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Arthur Tabachneck <art297@NETSCAPE.NET>
Subject: Re: How to transfer character variables into numeric variables by
using DO LOOP¡H
Content-Type: text/plain; charset=ISO-8859-1
Would the following do what you want?
data chen;
input a $ b $ c $;
cards;
1 2 3
a 4 5
6 b 7
8 c d
;
run;
data chen;
set chen;
array XXX[*] _character_;
array YYY[3];
do kk=1 to DIM(XXX);
YYY[kk]=input(XXX[kk],1.);
end;
run;
Art
---------
On Sun, 24 Jul 2005 04:57:04 -0400, subscribe sas-L Chen, Chiu-Chen
<angelina.aml@YAHOO.COM.TW> wrote:
>I have some mixed columns in an Excel data. So I read all variables into
>SAS as character variables. Now I want to transfer all character variables
>to numerical variables, but how should I write the program¡HI wrote the
>following program, but it doesn't work. Can anybody tell me where is wrong
>or how to write correctly¡H
>
> data chen;
> set chen;
> array XXX[*] _character_;
> do kk=1 to DIM(XXX);
> XXX[kk]=input(XXX[kk],1.);
> end;
> run;
|