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