Programming the statistical procedures from SAS

ERROR: Variable x in list does not match type prescribed for this list.

Reply
New Contributor
Posts: 2

ERROR: Variable x in list does not match type prescribed for this list.

Hi I am I new user to SAS and am trying to input some variables to preform an anlysis but one of my variables has some missing values (no data entries) that are entered as "." in my excel file but when I try to run this statement I get the error that the variable with the missing values (ecec) does not match type presribed for this list.

 

proc corr data= sernec;
var ph sand silt clay ksat ecec om;
run;

 


1114  proc corr data= sernec;
1115  var ph sand silt clay ksat ecec om;
ERROR: Variable ecec in list does not match type prescribed for this list.
1116  run;

 

Please help! I have the data all as numeric. thank-you!

PROC Star
PROC Star
Posts: 401

Re: ERROR: Variable x in list does not match type prescribed for this list.

One solution is to replace cells in Excel containing "." with blank cells (containing nothing). SAS will assign missing values to those fields.

 

Super User
Posts: 23,700

Re: ERROR: Variable x in list does not match type prescribed for this list.


emma93 wrote:

Hi I am I new user to SAS and am trying to input some variables to preform an anlysis but one of my variables has some missing values (no data entries) that are entered as "." in my excel file but when I try to run this statement I get the error that the variable with the missing values (ecec) does not match type presribed for this list.

 

proc corr data= sernec;
var ph sand silt clay ksat ecec om;
run;

 


1114  proc corr data= sernec;
1115  var ph sand silt clay ksat ecec om;
ERROR: Variable ecec in list does not match type prescribed for this list.
1116  run;

 

Please help! I have the data all as numeric. thank-you!


It doesn't matter what it is in Excel, it matters what SAS reads and stores it in. You can see the type using PROC CONTENTS. Run that on the data set and you'll see the type is likely character. 

 

You need to convert it to numeric, either by modifying the Excel file so that SAS reads it in as numeric or converting it after importing it. 

 

proc contents data=sernec; run;

To convert it via code you can use a data step and then try your PROC CORR again:

 

data sernec2;
set sernec;

ecec_num = input(ecec, ?? 8.);

run;
New Contributor
Posts: 2

Re: ERROR: Variable x in list does not match type prescribed for this list.

ecec_num = input(ecec, ?? 8.);

Hi does the above input specifiy that if there is a decimal "." to read it as no data ? I have all columns formatted in excel as numeric

Super User
Posts: 23,700

Re: ERROR: Variable x in list does not match type prescribed for this list.


emma93 wrote:
ecec_num = input(ecec, ?? 8.);

Hi does the above input specifiy that if there is a decimal "." to read it as no data ? I have all columns formatted in excel as numeric


A nice and very difficult thing with Excel, it doesn't force types on data/columns. INPUT is for after the import and the ?? suppresses any warning  messages so its not always the best idea.

 

 

 

 

Ask a Question
Discussion stats
  • 4 replies
  • 154 views
  • 0 likes
  • 3 in conversation