How to convert numeric date 20150601 to a date in Proc FEDSQL

Reply
New Contributor
Posts: 2

How to convert numeric date 20150601 to a date in Proc FEDSQL

How to convert numeric date 20150601 to a date in Proc FEDSQL?

Super User
Super User
Posts: 6,315

Re: How to convert numeric date 20150601 to a date in Proc FEDSQL

Any reason why it would be different than anywhere else in SAS?

input(put(NUMDATE,8.),YYMMDD8.)

Valued Guide
Posts: 854

Re: How to convert numeric date 20150601 to a date in Proc FEDSQL

Here is one way to do it, I'm not familiar with fedsql but this will work for you:

data have;

infile cards;

input num_date;

cards;

20150601

;

run;

proc sql;

create table want as

select *,input(put(num_date,8.),YYMMDD8.) as date format = yymmddn10.

from have;

New Contributor
Posts: 2

Re: How to convert numeric date 20150601 to a date in Proc FEDSQL

Thank you for the response. I am aware of how to do the conversion in proc sql, however I was asking about proc fedsql. As part of SAS 9.4 proc fedsql is new and has some new functions that proc sql does not have, but it also has some disadvantages as input is not an available function.

Valued Guide
Posts: 3,206

Re: How to convert numeric date 20150601 to a date in Proc FEDSQL

fedsql has a quite different goal. That one has those changes to  get more aligned in what RDBMS systems are doing. (different data types).

As your data conversion will be normally doen by SAS/ACCESS interfaces the manual numeric/string conversion is a non-question.
Temporal manipulations is added in SQL:2011 https://en.wikipedia.org/wiki/SQL:2011 SAS is not using that instead kept on sql:99

---->-- ja karman --<-----
Ask a Question
Discussion stats
  • 4 replies
  • 263 views
  • 0 likes
  • 4 in conversation