What you had didn't check for numbers, which is why the ELSE was mentioned. Yours checked if it was == to the number and if it wasn't == to the number. A check where there are only 2 possibilities can use ELSE for the second possibility. If you want it to check for numbers...

Code:
on *:TEXT:!guessnumber*:#:{
  var %guessnumbernum = $rand(0,100) 
  echo -a The number is %guessnumbernum
  if ($2 !isnum) { msg $chan Pick a number. Syntax is !guessnumber number }
  elseif ($2 != %guessnumber) { msg $chan Sorry, that's not the number. Try again? }
  else { msg $chan YOU WIN! }
}


Note that it's changed to use !isnum and then you don't have to worry about whether or not it's a number when you get to the last two lines. ELSEIF and ELSE work just fine in this case.

As far as your echo, you are using control codes (colors), which is why you have an error. It has nothing to do with /var. You have to put spaces around the variable...

Guess the number: The number is4 %guessnumbernum  

instead of:
Guess the number: The number is 4%guessnumbernum  


Another piece of advice... Avoid using single digit color codes (like 4). Make it double digit (04) instead. Otherwise, if a number follows it (4 $+ %num where %num == 1), that will try to use color 41, which isn't the same as 4. If you make it 04, then even if a number follows (041), it won't mess up your colors.