Help using Base SAS procedures

hybrid format in the dataset, How to input into SAS

Reply
Contributor
Posts: 56

hybrid format in the dataset, How to input into SAS

I have the dataset with a column of DATE. However, my supervisor arranged the file from different sources. So the column of DATE in the excel file are not all in DATE formate. eg.

There are both 25/06/2001, and 20000312 in that column, which the first is DATE format, but the second is recognized as numerical value. It's fairly easy to input just with either of them. But how to input both types of DATE presenting in the same column?

Thank you very much.

Fred
Respected Advisor
Posts: 3,889

Re: hybrid format in the dataset, How to input into SAS

Hi Fred

Use the informate ANYDTDTEw. as it digest different date strings and transforms them into as SAS date, i.e:

data _null_;
infile datalines;
input mydates:ANYDTDTE10.;
format mydates date9.;
put mydates=;
datalines;
25/06/2001
20000312
;


HTH
Patrick
Ask a Question
Discussion stats
  • 1 reply
  • 104 views
  • 0 likes
  • 2 in conversation