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?
It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
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
It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
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

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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