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

Hi all,

Whenever I import my data into SAS, this note below. Any ways around keeping the original data type when using proc import. Thanks.

NOTE: One or more variables were converted because the data type is not supported by the V9 engine.
For more details, run with options MSGLEVEL=I.

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

@Rou wrote:

I checked and some of my variables that were in character format previously are now numeric. 


That cannot happen.  If you import the same spreadsheet again using the same code the result will be the same.

 

But if you import a DIFFERENT spreadsheet (even one you think has the same type of columns) then you can get different variable types.  That is because the TYPE of the variable created depends on the types of CELLS that are in the column.

 

For example if you have a column that nominally should be numeric but one cell has a string, such as 'NA' , in it then SAS will have to make a character variable to be able to store that character cell.

 

Another example is if you have column that nominally should be numeric but all of the cells are empty then SAS will make a character variable of length $1 since that takes less space than a numeric variable which requires 8 bytes of storage.

View solution in original post

4 REPLIES 4
Tom
Super User Tom
Super User

You can ignore that note. 

 

No idea why it generates that message, probably related to re-using a function/subroutine that can also be used in a situation where that message might make a difference.  SAS datasets only have two types of variables, fixed length character strings and floating point binary numbers.   Apparently something in the process is treating the EXCEL character strings as variable length strings so in theory they are changing data types since they are being converted into fixed length strings in the SAS dataset. But in reality nothing is being changed.

 

Rou
Obsidian | Level 7 Rou
Obsidian | Level 7

I checked and some of my variables that were in character format previously are now numeric. 

Tom
Super User Tom
Super User

@Rou wrote:

I checked and some of my variables that were in character format previously are now numeric. 


That cannot happen.  If you import the same spreadsheet again using the same code the result will be the same.

 

But if you import a DIFFERENT spreadsheet (even one you think has the same type of columns) then you can get different variable types.  That is because the TYPE of the variable created depends on the types of CELLS that are in the column.

 

For example if you have a column that nominally should be numeric but one cell has a string, such as 'NA' , in it then SAS will have to make a character variable to be able to store that character cell.

 

Another example is if you have column that nominally should be numeric but all of the cells are empty then SAS will make a character variable of length $1 since that takes less space than a numeric variable which requires 8 bytes of storage.

Rou
Obsidian | Level 7 Rou
Obsidian | Level 7
Makes sense, thank you!

sas-innovate-2024.png

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
  • 4 replies
  • 315 views
  • 2 likes
  • 2 in conversation