BookmarkSubscribeRSS Feed
skallamp
Obsidian | Level 7

I am running the PROC Discrim function to do the classification, however I am getting the below error while testing the results.

Does anyone know what does this mean? I had doublecheckd and ensured that there are more than two classes available in the dependant variable.

ERROR: At least 2 complete classes are required in DATA= data set or

BY group.

Here are the steps I am following.

Step 1

~~~~~

Proc discrim data = test_data outstat=test_result METHOD=NORMAL POOL = no CROSSVALIDATE;

class trend;

var var1 var2 var3 var4 ; PRIORS PROPORTIONAL; RUN;

 

Step 2 - Here I need to test me previous results in data set

~~~~~~

 

Proc discrim data = test_result TESTDATA=universe_data TESTOUT = UNIVPRED;

class trend;

var var1 var2 var3 var4 ; PRIORS PROPORTIONAL; RUN;

 

Error : At least 2 complete classes are required in DATA= data set or

BY group.

 

I tested keeping the trend blank and keping some dummy names used in the test data, but same error message.

 

 

 

 

 

1 REPLY 1
PGStats
Opal | Level 21

Seems like your TESTDATA= dataset must contain observations from at least two of your classes. I don't know why.

 

proc discrim data=sashelp.iris outstat=irisstat
             method=normal pool=no;
   class Species;
   var SepalLength SepalWidth PetalLength PetalWidth;
   priors proportional;
run;

proc discrim data=irisstat testdata=sashelp.iris testout=testout;
where species = "Setosa";
class species;
run;

 

PG

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 988 views
  • 0 likes
  • 2 in conversation