BookmarkSubscribeRSS Feed
Calcite | Level 5


I am running into the same problem. I am using work.import to convert data from excel into SAS. When I am trying to create a line graph, I am getting a very weird graph, as shown below. I am not really sure how to fix this, or why I am getting this. 


Super User

A "line graph" of frequencies like that means that what ever you are counting only has one observation for each xaxis value. So I am not sure that particular graph can be "fixed" to display much else. Since the variable on the X axis is character it is getting treated as "discrete" so each value is attempting to display but there are so many the text overlaps.


I am going to make some guesses here, so you need to confirm or deny.


First, both of the variables are character from the image you show. From the sort of values I can see from the horizontal axis it appears the values are 5 characters, consisting of digits starting with 4. That is a strong indicator that the value in Excel may have been a Date for the variable on the xaxis But due to some issue the value was treated as character.

You can search this forum and find hundreds of examples where "importing" Excel files results in variables of an unexpected type and specifically dates as character.


From the data set name I am also guessing that either Proc Import or a wizard was used to "import" the data. Both of these have issues depending on the content of the the Excel file.

Common problems that can do this to supposed date values:

1) more than one row of "header" information in the Excel file. If this is the case, make sure there is only one row with column headings in the Excel file.

2) Some cells in the column have non-"date" values. Either manually entered as character or words like "Missing" "NA" "NULL" "To be determined" or something else that makes the import treat the values as character. One fix: remove such from the file. Other fix, Save the file as CSV and write a data step to read the data with a data step and set the properties of the data with informat or attrib statements.


Or search the forum for the Excel date character to numeric SAS date values.


With a variable that is numeric and a date with a proper SAS date format such as DATE9. applied to the axis variable you should get tick marks at some intervals and values that look like dates. If you use a format that would group dates to an interval like YYMON5. , which would display a date like 31Mar2021 as 21MAR then the group imposed on the date should count the values in the month that appears.




Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.


Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1 reply
  • 2 in conversation