BookmarkSubscribeRSS Feed
emma93
Calcite | Level 5

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!

4 REPLIES 4
sld
Rhodochrosite | Level 12 sld
Rhodochrosite | Level 12

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

 

Reeza
Super User

@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;
emma93
Calcite | Level 5
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

Reeza
Super User

@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.

 

 

 

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1448 views
  • 0 likes
  • 3 in conversation