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

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 8662 views
  • 0 likes
  • 3 in conversation