Date: Wed, 8 Dec 2004 11:37:52 -0500
Reply-To: Jonas Bilenas <Jonas.Bilenas@CHASE.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jonas Bilenas <Jonas.Bilenas@CHASE.COM>
Subject: Re: Why INPUT function can not change missing values to numeric
type?
I have no problem converting missing character to missing numeric. Try to
change the function to point to a new variable:
> Y02_NUM=INPUT(Y02,BEST10.2);
> Y01_NUM=INPUT(Y01,BEST10.2);
On Wed, 8 Dec 2004 11:27:05 -0500, Fred <ieaggie2002@GMAIL.COM> wrote:
>Hi, all
>
>I have a simple type conversion problem as below:
>Supose my .txt data set is T1.txt:
>ProductID Y99 Y00 Y01 Y02
>abc 10 20 15 -
>xyz 25 40 50 -
>def 10 30 - -
>ghl 2 7 - -
>...
>
>My SAS code is:
>PROC IMPORT DATAFILE = 'T1.txt' OUT = T1
> DBMS = TAB REPLACE;
>RUN;
>DATA External;
> SET External;
> Y02=INPUT(Y02,BEST10.2);
> Y01=INPUT(Y01,BEST10.2);
>RUN;
>PROC SQL NOPRINT;
> SELECT name INTO:num_list separated BY " "
> FROM dictionary.columns
> WHERE libname="WORK" AND memname="T1" AND type="num";
>Quit;
>PROC TRANSPOSE DATA=T1 OUT = T1;
> VAR &num_list;
> ID ProductID;
>RUN;
>The LOG window outpus is:
>****************
>2316 DATA External;
>2317 SET External;
>2318 Y02=INPUT(Y02,BEST10.2);
>2319 Y01=INPUT(Y01,BEST10.2);
>2320 RUN;
>
>NOTE: Numeric values have been converted to character values at the
>places given by: (Line):(Column).
> 2318:9 2319:9
>NOTE: Invalid argument to function INPUT at line 2319 column 9.
>***************
>And the transposed output table T1 is:
>_NAME_ abc xyz def ghl
>Y99 10 25 10 2
>Y00 20 40 30 7
>
>I do not know why I cannot change the missing values in columns Y01 and Y02
>to be numerical values for my further use.
>
>Thanks for your correction.
>
>Fred
|