Tuesday, November 19, 2013

Convert CHAR to NUM in PROC SQL

Use TO_NUMBER function in PROC SQL.

proc sql;
   connect to oracle (user=xxx orapw=yyy path="@zzz");
     create table temp as
       select * from connection to oracle
              (select aa, to_number(bb) as bb, to_number(cc) as cc
                          from xxx.dddd)
       where bb ne . or cc ne .
       order by aa;
   disconnect from oracle;
quit;
run;

3 comments:

Anders Sköllermo said...

Hi! According to GOOGLE the TO_NUMBER function is part of Oracle SQL. Perhaps it is available also n other dialects of SQL. Quite interesting.
/ Br Anders Skollermo

Rick Pack said...

I discovered that TO_NUMBER did not work in SAS 9.1.3.

Unknown said...

It was very nice article and it is very useful to SAS OC learners.We also provide Cub training software online training.