If date_of_joining is a date variable, you would need to change to:
IF DATE_OF_JOINING <= "03Jan2020"d THEN ENVIRONMENT='NORMAL';
ELSE ENVIRONMENT= 'PANDAMIC';
"03Jan2020"d is a date literal. Your current code:
IF DATE_OF_JOINING <= 01/03/2020 THEN ENVIRONMENT='NORMAL';
ELSE ENVIRONMENT= 'PANDAMIC';
will run without error, but SAS will interpret 01/03/2020 as being division.
1 data _null_ ;
2 x=01/03/2020 ;
3 y="03Jan2020"d ;
4 put x= y=;
5 run ;
x=0.0001650165 y=21917
Note if any records have missing values for Date_Of_Joining, this would categorize them as Normal.
The Boston Area SAS Users Group is hosting
free webinars!
Next webinar will be in January 2025. Until then, check out our archives:
https://www.basug.org/videos. And be sure to subscribe to our our email list.