In the Postgresql Documentation manual for 9.6.3. I am using windows system and when i execute "CREATEDB MYDB;", i got "ERROR: syntax error at or near "createdb"". And when i execute "CREATE DATABASE MYDB;", it worked fine. Same goes for dropdb command.
You run "createdb" in your operating system's shell. You run "create database" with psql or some other SQL executing client. From your description you appear to be in an SQL executing program hence createdb and other command line applications will not work.