BookmarkSubscribeRSS Feed
mokleber
Calcite | Level 5

I am very new to SAS as I am learning it currently for a college course. I am getting this error, "ERROR: Expression using equals (=) has components that are of different data types.", with the following code;

libname mk "/home/u62148011/sasuser.v94";
run;

proc contents data= mk.aha;
run;

PROC SQL;
CREATE TABLE WORK.query AS
   SELECT PHAGMISS

   FROM mk.aha

   ORDER BY PHAGMISS= "5";
RUN;
QUIT;

 

I believe the error is occurring with the ORDER BY statement. Any advice or help you can give would be great.

2 REPLIES 2
ballardw
Super User

It would appear that your variable PHAGMISS is numeric.

Look at your Proc Contents output. Does it show NUM as Type for that variable? Num means numeric in Proc Contents type values.

 

Why do you have an = on the Order by anyway? Do you want the records where Phagmiss=5 to be at the end?

Kurt_Bremser
Super User
ORDER BY PHAGMISS= "5";

PHAGMISS seems to be numeric.

Your ORDER BY value is the result of a comparison, so the ORDER BY clause will put all the 5's at the end of the resulting dataset. Is this what you want?

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 404 views
  • 0 likes
  • 3 in conversation