hello,
I want to write an ado file in which I have one numeric argument, one string argument, and one option.
The code looks like this one:

Code:
capture program drop prEM
program prEM

version 15.1
syntax anything [, REGion(numlist >0 integer)]           
tokenize `anything'
local final_date `1'
local sex `2'
di `sex'
di `final_date'

The numeric argument is something like 300420, that is a date which I use to select a dataset;
the string argument is M or F, that I use to select cases by sex;
in the option I would like to present a list of region codes that I use to select cases (if no option is given, the whole country is analyzed).

With the code specified above, I get the following error:

Code:
. prEM 300420 F, reg(8)
F ambiguous abbreviation
r(111);

Before, I tried using namelist in syntax, and I got this error:

Code:
. prEM 300420 F, reg(8)
300420 invalid name
r(198);

It seems to me that the problem is using a numeric and a string argument together.
By the way, it all worked fine until I used args with date, sex and region as arguments, but now I have to specify region as on option, so I'm trying syntax.

Can someone give me advice?
thanks a lot