Convert String to Number in SAS

sas
format
string

#1

Hi,

I have imported a data set to SAS from txt file and after importing one numeric field is imported as character. Now I want to convert it to Numeric format, below is the data set after importing.

Please help to convert Amount field to number.

Thanks,
Steve


#2

Data (outfile name)(drop= amount);
Set (IP name) ;
Amount_new = amount*1;
Run;

Hope this will help.

Regards,
Aayush


#3

Similar to @aayushmnit answer, you can also try:

Data (outfile name)(drop= amount);
Set (IP name) ;
Amount_new = amount + 0;
Run;

#4

Data (outfile name)(drop= amount);
Set (IP name) ;
amount_new=input(amount,3.);
run;