11-14-2013 10:35 AM
this below is an excel 97 file i have imported into SAS.
After importing is done age ends up being defined as numeric.I read an article that if in the guessed rows we have char and num under the same column then automatically that column gets defined as char.
Also guessingrows and DBDSOPTS are not working in my proc import codes. is this cuz i have SAS9.2?
11-14-2013 10:47 AM
Could you provide your code? Each guessingrows and dbdsopts were existing features of 9.2 and should've provided you with means to import age as character if that was your desired input.
11-14-2013 11:08 AM
here is my code:
proc import datafile='C:\Users\Tal\Desktop\class.xls' out=new replace;
DBDSOPTS = 'firstobs=3'; (so i have two rows of text between the column names row and the actual data i dont need into sas
11-14-2013 11:40 AM
Without Mixed it will use a default number of rows at the top of the data to assign a variable type. If all of the first rows, and I'm not sure how many that is, are numeric then the variable is assumed to be numeric.
Looking at my documentation I'm not even sure that guessingrows has any effect on excel imports.
11-14-2013 09:03 PM
here is some text of an article posted by H Droogendyk
"Note that age is a character variable because the “N/A” value was found within the first number of rows ( i.e.
GUESSINGROWS value ) in an otherwise numeric column. If the first number of rows had all been numeric and the
“N/A” was found in a row beyond the GUESSINGROWS value, the column would have been defined as numeric and
the age value would have been set to missing for the observation with “N/A”.
So the problem here is that my n/a value was within GUESSINGROWS not beyond so i thought he talks about older verisons of SAS here
11-14-2013 09:22 PM
if it is a csv file and only one n/a value then age is defined as char in the output set but if it is a xls then SAS goes by whatever type has more values .That's insane!