You are receiving the error "error: bad function: 1" because of this expression following the IF function:
Firstly, 'nil' is a protected symbol meaning just that (nil); 'nilnil' is just an symbol which happens to not be used as a variable at this point, and so also evaluates to nil; better to avoid the risk of 'nilnil' being something other than nil, and just use 'nil' instead.
Now, back to your error, if 'ss' is non-nil,
is being evaluated first, and, since setvar returns the value that the System Variable is set to, this expression returns 1.
Now, the value 1 returned is following an un-quoted open parenthesis:
And so is now interpreted as a function (any symbol following an un-quoted open parenthesis is evaluated as a function - this is how LISP is interpreted). And, of course, '1' is not a function - hence your error.