Desktop productivity for business analysts and programmers

SAS EG date formats

Accepted Solution Solved
Reply
Contributor
Posts: 23
Accepted Solution

SAS EG date formats

[ Edited ]

Dear SAS EG users,

I met a trouble last week and cannot figure it out. The problem is that the output of SAS program looks good, but the visizulation (bar graph, the frequency of a column named READ_DT) of result obveriously wrong. I had two tables, both of them had a column named READ_DT. Both cloumn shared the same format and informat, ie date9.. To my surprise, the frequency distribution of one table looks correct (Bar chart 2), but not the another one (Bar Chart 5). I don't know why and how to solve it. For deails please see attachments.

Thanks,

Harry


Accepted Solutions
Solution
‎11-02-2015 04:54 PM
Super User
Posts: 11,134

Re: SAS EG date formats

Run something like this:

 

Proc freq data=barchart5dataset;

freq read_dt;

format read_dt best12.;

run;

 

I will bet that your data source has an issue, either it is including some time values or simple data entry errors.

 

And where did you read the data from?

View solution in original post


All Replies
Community Manager
Posts: 2,889

Re: SAS EG date formats

I see just one attachment with one chart (5). Do you have the other chart (2) to supply?
Contributor
Posts: 23

Re: SAS EG date formats

Thanks ChrisHemedinger a lot for your quick message. I selected two files and unfortunately, only one of them attached. Here is Bar Chart #2.

Sorry for my careless.

Best,

Harry

Community Manager
Posts: 2,889

Re: SAS EG date formats

I see that the values in Chart 5 are quite erratic. Is it possible that in one data set, READ_DT is a Date type, but in another it's a Date-Time type?

Dates in SAS - number of days since Jan 1, 1960.
Date-time in SAS - number of seconds since Jan 1, 1960
Contributor
Posts: 23

Re: SAS EG date formats

No, both of them are date type and have the same format. Here is sample of data and attribute of the column in two data set.
Bar chart 5
11JUN2015
11JUN2015
11JUN2015
11JUN2015
12JUN2015
12JUN2015
12JUN2015
12JUN2015
Name Type Length Format Informat Label
READ_DT Date 8 DATE9. DATE9. READ_DT


Bar Chart 2
01JAN2015
01JAN2015
01JAN2015
01JAN2015
01JAN2015
Name Type Length Format Informat Label
READ_DT Date 8 DATE9. DATE9. READ_DT
Super User
Posts: 19,167

Re: SAS EG date formats

Run a one way table analysis on your data by date to see the results. The problem most likely is with your input data set. If that output doesn't match the graph then SAS is doing something wrong.
Frequent Contributor
Posts: 108

Re: SAS EG date formats

Hi ,

can you please explain what portion is wrong ? the date format in the pdf (which is not very clear). Or the Graph itself the Bounds?

Solution
‎11-02-2015 04:54 PM
Super User
Posts: 11,134

Re: SAS EG date formats

Run something like this:

 

Proc freq data=barchart5dataset;

freq read_dt;

format read_dt best12.;

run;

 

I will bet that your data source has an issue, either it is including some time values or simple data entry errors.

 

And where did you read the data from?

Contributor
Posts: 23

Re: SAS EG date formats

Hi Ballardw,

I think you are right that my data source has an issue. The data source is from Teradata warehouse, which showed some wired data when I extracted raw data directly from database.

Thanks you and others for helpful information and suggestion.

Best regards,

Harry

Super User
Posts: 19,167

Re: SAS EG date formats

Teradata would typically be a datetime variable as suggested by others.
Community Manager
Posts: 2,889

Re: SAS EG date formats

You might still be able to work with this data using a DT format instead of DATE9.

 

See this blog post for ideas:

http://blogs.sas.com/content/sasdummy/2011/11/15/do-you-mind-if-we-dance-with-your-dates/

 

Chris

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 10 replies
  • 953 views
  • 0 likes
  • 5 in conversation