02-12-2016 12:13 PM
I have imported a file that has column names. One of them is biomf and bourgf. I then want to analyse the data in those columns but it says
ERROR: Variable biomf in list does not match type prescribed for this list. (The same for bourgf)
/** Import an XLSX file. **/
PROC IMPORT DATAFILE="/folders/myshortcuts/Myfolders/D_2015.xlsx"
/** Print the results. **/
PROC PRINT DATA=WORK.chiend15; RUN;
proc glm data=work.chiend15;
class trt bloc;
model biomf bourgf=trt bloc;
02-12-2016 12:30 PM
what are the formats for these two variables? I would guess that SAS is importing them as characters or something unexpected.
02-12-2016 01:25 PM
When using Proc Import with XLS and XLSX files the Excel data engine looks at the first few rows of data and then describes that to SAS. If any of the first few rows has something that might be interpretted as character, even just a second row of column headings, then the data will be treated as text not numeric.
You might want to consider running Proc Contents after any import of XLS or XLSX using Proc Import to see if the variables are as you expect.
Also a common issue when going to combine multiple files that you think have the same layout is one import with character and another with numeric in the same column, which will cause errors when combining, or different lengths for character variables which will generate warnings and possibly result in truncated data.