BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
radha009
Quartz | Level 8

i have in my data , weekno, day , name , email and type, i am trying to get if monday (2) get the row. I couldn;t find the weekname function, so i added weekday function to get the weekday number.

 

&weekday. = 5 

 

 

data sh.ext_supp;
set sh.ext_support;
where weekno = "&weekday";
run;

 

 

data sh.ext_supp;
476 set sh.ext_support;
477 weekday = put(weekday,12.3);
478 where weekday = "&weekday";
ERROR: WHERE clause operator requires compatible variables.
479 run;

NOTE: Character values have been converted to numeric values at the places given by:
(Line):(Column).
477:11
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set SH.EXT_SUPP may be incomplete. When this step was stopped there were 0
observations and 6 variables.

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

So is WEEKDAY a numeric variable

where weekday=5;

or a character variable?

where weekday="5";


I do not see any WEEKDAY() function being used in the code you posted.

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

So is WEEKDAY a numeric variable

where weekday=5;

or a character variable?

where weekday="5";


I do not see any WEEKDAY() function being used in the code you posted.

Kurt_Bremser
Super User

A where condition works only on values present in the incoming data, not on values calculated in the step.

Since the weekday variable is numeric, you must compare it to a numeric value:

where weekno = &weekday.;

Since the type of a variable cannot be changed, this statement does not make sense:

weekday = put(weekday,12.3);

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!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

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