I often have problems with converting the result of the weekday function which gives you sunday as first day of week. However in our part of the world we use monday as first day of week.
Here is a function that kan do just that - convert:
proc fcmp outlib = work.funktion.dk_ugedag;
function dk_ugedag(_sasdato);
return(weekday(_sasdato)-1+(weekday(_sasdato)=1)*7);
endsub;
run;