Help using Base SAS procedures

Issue with Date format

Reply
Occasional Contributor
Posts: 12

Issue with Date format

my data resides in an Oracle DB. I extract data from the DB in csv format. For the date field I use

to_char(BIRTH_DT,'DD-MON-YYYY') to get the date. I then import the csv file into SAS using Proc Import.

I extract two sets of data from the ORACLE DB - both different due to other constraints. The BIRTH_DT field is common in both the sets.

When I import one set of data, SAS reads it is a DATE. For the other other set it reads it as DATETIME. I do not understand why the same column is being interpreted by SAS in different ways.

Any help will be deeply appreciated.

Super User
Posts: 5,257

Issue with Date format

If you haven't used it, you might want to look at:

GUESSINGROWS=n;

statement. You might have some data quality issues in first rows of data?

/Linus

Data never sleeps
Super User
Posts: 10,516

Issue with Date format

If I know I'm going to be reading the same layout file multiple times I usually take the data step code generated by PROC IMPORT and modify it to reduce such suprises. That way I control any informats, lengths of string variables,

variable names, labels and such.

Occasional Contributor
Posts: 12

Issue with Date format

I did use the same proc import code for reading both the data files.

Occasional Contributor
Posts: 12

Issue with Date format

I figured the issue. In one case all the rows had values for BIRTH_DT, in other data set 10th row was blank. I do not want to discard that row of data since there are other information in the table i would like to use. Do you know if guessingrows will work in such scenario? going to try it out.

Ask a Question
Discussion stats
  • 4 replies
  • 180 views
  • 0 likes
  • 3 in conversation