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);

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 2 replies
  • 8617 views
  • 0 likes
  • 3 in conversation