Hi Statalists,

I have code like this:

Code:
regress y x1 x2 x3
egen p10 = pctile(x1), p(10)
egen p20 = pctile(x1), p(20)
margins, at (x1= (p10 p20))
which gives me the error "invalid numlist".

I know that x1 is between 0 and 1, so my first (and prefered) attempt was

Code:
margins, at (x1=(0(0.1)1))
but margins only works, if 0, 0.1, 0.2, ... are explicitly in my data, which is not the case, as I rather have values like 0.1223123 in my data set.

Can you help me to make either the first (with percentiles) or the second version (evaluation margins at values not in the data set) work? I have the feeling it's just about type casting the variables p10 and p20 correctly.

I really tried to find help online but very different errors are treated under "invalid numlist".

All your help is highly appreciated!

Best,
Chris