Whenever you embed an quoted text within another quoted text, you have to add two quotes instead of one.
This statement
ISNULL( NULLIF( LTRIM( RTRIM( [state] ) ), '' ), 'false' )
should be changed to
ISNULL( NULLIF( LTRIM( RTRIM( [state] ) ), '''''' ), '''false''' )