I was trying to generate

I tried to use tempvar, it also requires to state your observations, which is only 1 in this case, and stata gives the same error: observation number out of range

So, my question is, how can I generate one positive random integer and use this random integer in the next moves within my dofile where I already loaded some observations.

Thanks!

**positive random integer between, say, 0 and 10, in my dofile. In doing so, I have to set obs 1 to indicate that I want only one random integer. But the problem is I already read one dataset into stata which has certain observations. Obviously, stata gives the error: observation number out of range**__one__I tried to use tempvar, it also requires to state your observations, which is only 1 in this case, and stata gives the same error: observation number out of range

Code:

clear all sysuse auto set seed 123 set obs 1 gen random=floor((10-0+1)*runiform()+0)

Thanks!

## Comment