Your PL/SQL block is incomplete. It needs:
END; -- to end it
/ -- to run it
BTW, why go through all the pain of declaring, opening, fetching, testing NOTFOUND and closing cursor when this does the same job? :-
BEGIN
for r in (select table_name from user_tables) loop
EXECUTE IMMEDIATE 'analyze table ' || r.table_name || ' compute statistics';
end loop;
END;
/