04-08-2015 09:35 AM
I am trying to convert a number to a SAS Date YYMMDD8. I m using proc Sql; from Oracle table to BASE SAS table.
Input(put(date,8.),yymmdd8.) as Descn_date,
I have around 80 columns and around 30 columns have date as number for e.g 20150306 and so
I m not able to convert it
Pls help me on this.
04-08-2015 10:00 AM
If your date field actually contains just numbers like (20151003) then your code should have worked. Does your log provide any clue?
Conversely, is there a chance they are really numbers represented as a string?
If so, you could use something like:
proc sql noprint;
create table want as
select Input(date,yymmdd8.) as Descn_date format=date9.
04-08-2015 10:03 AM
Well, there are a few things here. Firstly, by proc sql from oracle table, does this mean you are using pass through and executing statements on the Oracle server? If so you probably wont be able to use SAS functions. Also, the "date" from Oracle is different.
I would suggest that you start by extracting the data as it is to a SAS dataset:
connect to oracle ...;
create table TMP as
select * from connection to oracle (
select * from SCHEMA.YOU_TABLE);
disconnect from oracle;
Now examine the data you have got back. The dates can processed using normal SAS techniques:
I don't have an Oracle server here so can't check any of the above, but that is what I think you are getting stuck on.