BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
HarryLiu
Obsidian | Level 7

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

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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

10 REPLIES 10
ChrisHemedinger
Community Manager
I see just one attachment with one chart (5). Do you have the other chart (2) to supply?
SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
HarryLiu
Obsidian | Level 7

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

ChrisHemedinger
Community Manager
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
SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
HarryLiu
Obsidian | Level 7
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
Reeza
Super User
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.
pearsoninst
Pyrite | Level 9

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?

ballardw
Super User

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?

HarryLiu
Obsidian | Level 7

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

Reeza
Super User
Teradata would typically be a datetime variable as suggested by others.
ChrisHemedinger
Community Manager

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

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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