Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

One of my date column doesn't read in date format, but I need to use the function WEEKDAY() on it. How can I transform the data format of that column into date format?

UPDATE: It is a csv file, following is one of the rows

01OCT2007,4.92,7.75

share|improve this question
Can you tell how the column looks in the source data file? Is it a csv/txt file after all? – psj Dec 7 '11 at 12:27
@psj This is a csv file – Benjamin Dec 7 '11 at 12:56

1 Answer

up vote 2 down vote accepted

How about this (where foo.txt contains your data without column names)

data foo;
    infile "foo.txt" delimiter=',';
    informat a date.;
    format a date.;
    input a b c;
run;

?

psj

share|improve this answer
Thanks!! It works!! Would you mind telling me why I cant use PROC import to handle the date? – Benjamin Dec 7 '11 at 13:34
@Benjamin: you can. If I use instead PROC IMPORT OUT= WORK.FOO DATAFILE= "foo.csv" DBMS=CSV REPLACE; GETNAMES=NO; DATAROW=1; RUN; I get the same result as above. – psj Dec 7 '11 at 13:42
Hum.. My code should be something wrong, I cant work with this code. Anyway Thanks!! – Benjamin Dec 7 '11 at 14:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.