BookmarkSubscribeRSS Feed
Lwen
Calcite | Level 5

I want to do Discriminant Analysis by using SAS. But there is something wrong in my data set after I transfered the character data into numeric data.

 

At first, the dataset were character, so my first step was to tranform it into numeric data, by using following data:

data newalcohol;
set alcohol(rename=(Meoh=old1 Acet=old2 Bu1=old3 Mepr=old4 Acal=old5 Lnpr01=old6));
Meoh = input (old1,best5.);
Acet= input (old2,best5.);
Bu1 = input (old3,best5.);
Mepr = input (old4,best5.);
Acal = input (old5,best5.);
Lnpr01 = input (old,best5.);
drop old1 old2 old3 old4 old5 old6;
run;

 

And then, I used the following data to do the test:

 

【title'Discriminant Analysis of Alcohol';
title2'Using Discriminant Function';
proc discrim data = newalcohol outstat=newalcohol
wcov pcov method = normal pool = test
distance anova manova listerr crosslisterr;
class type;
var Meoh Acet Bu1 Mepr Acal Lnpr01;
run;】

 

However, the warnings showed up here:

 

WARNING: 77 observations in DATA= data set or BY group will not be included in the analysis due to missing values.
ERROR: At least 2 complete observations are required in DATA= data set or BY group.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 77 observations read from the data set WORK.NEWALCOHOL.
WARNING: The data set WORK.NEWALCOHOL may be incomplete. When this step was stopped there were 0 observations and 9 variables.
WARNING: Data set WORK.NEWALCOHOL was not replaced because this step was stopped.


I believe there must be something wrong within my dataset, but I didn't know how to fix it.

 

Can anyone help me? Thank you.

1 REPLY 1
Lwen
Calcite | Level 5
I sloved it by myself

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 604 views
  • 0 likes
  • 1 in conversation