You're probably trying
fname = 'foobag';
save fname variable;
To do this correctly, you need to use the "functional" form of save:
fname = 'foobar';
save(fname, 'variable');
In fact, it is true in general that the following two lines are equivalent:
command str1 str2 str3
command('str1', 'str2', 'str3')
This allows one replace any or all of the parameters with dynamically generated strings. This is also useful in commands like PRINT, LOAD, CLEAR, etc.
[From the MATLAB FAQ of Ancient Times]