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"
OUT=WORK.chiend15
DBMS=XLSX
REPLACE;
RUN;
/** Print the results. **/
PROC PRINT DATA=WORK.chiend15; RUN;
proc glm data=work.chiend15;
class trt bloc;
model biomf bourgf=trt bloc;
means trt;
what are the formats for these two variables? I would guess that SAS is importing them as characters or something unexpected.
SAS is importing them as alphanumeric...
were you expecting them to be continuous? can i have an example of what your data looks like?
it worked when i changed the data in excel from 6.08 to 6,08 for example so now it reads the data as numeric data !
nice, i knew something was off with the data import. glad the results are as expected now.
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.
Maybe variable biomf turn into CHARACTER not NUMERIC .
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.