To convert an alkylcarbamoyl group to a cyano group, the alkylcarbamoyl compound is reacted with a halogen compound capable of acting as a halogenating agent, preferably chlorinating agent, for example oxalyl chloride, phosphorus oxychloride or sulfonyl chloride.