You must put your code inside a user defined function. It will not work on a sql window. Example below is a function that returns the number you send.the variable
--mybase is your database name. If public, remove it.
CREATE OR REPLACE FUNCTION mybase.my_new_rotine(numeric)
RETURNS numeric AS
$BODY$
--here, get the first variable from function
declare id numeric= $1;
begin
--return the number
return id;
end;
$BODY$
LANGUAGE plpgsql VOLATILE
An then, you can use it on a sql window, like this:
select * from mybase.my_new_rotine(1)
will return 1