Hi
I am trying to run linear discriminant analysis on my data but I am running into this error and I am not sure on how I need fix my data to overcome the error. I am going to attach my raw data:PARKDAT here (80 obs) and my test data:newdata (16 obs). (I am using the most recent version of SAS Studio) This is the code I ran:
Proc Discrim Data=PARKDAT Method=Normal testdata=newdata Pool=Yes
pcov listerr crosslisterr Crossvalidate testlist;
Class Status;
Var _NUMERIC_;
Priors Prop;
Have you confirmed that it is the course of the problem?
The best way to fix it is when you import the data. You haven't stated how you read the data into SAS, so I can't say more.
You can also fix it after importing by using the LENGTH statement. For example,
data NewData2;
length Status $13;
set NewData;
run;
It is always best to paste the EXACT error message from the SAS log.
I am going to guess that the length of the Status variable in the PARKDAT data set is different than the length of the same variable in the NEWDATA data set. You can use PROC CONTENTS to examine the lengths.
Hi Rick
Typically how do you go about fixing that?
Have you confirmed that it is the course of the problem?
The best way to fix it is when you import the data. You haven't stated how you read the data into SAS, so I can't say more.
You can also fix it after importing by using the LENGTH statement. For example,
data NewData2;
length Status $13;
set NewData;
run;
By default, PROC IMPORT looks at the first 20 rows to guess things like length and format, so you can try to add
guessingrows=max;
before your RUN statement.
As you probably know, for delimited files PROC IMPORT is just a front end to a DATA step. You can see the DATA step code in the log. If you want, you can copy the code and add a LENGTH statement.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.