That's because you can't use a value from a SELECT, outside the SELECT. To assign the value is easier than you might have thought.
Declare @ratecodeVar varchar(15)
SELECT @ratecodeVar = COALESCE(NULLIF(over_rate2,''), NULLIF(over_rate,''), std_rate)
FROM dbo.matter
WHERE clt_code = 'AME021'
AND mat_code = 'C133244'
By the way, there's no such thing as global variables (user-defined at least) in SQL Server. All of them are local variables.