I have a dataset with individual prison spells, e.g.:
I want to create a variable that takes on a random day within the prison spell, but this random day also has to be either a saturday or a sunday.
So far I have written:
which satisfies the first condition (it gives me a random date within start-end).
Is there a way to restrict the random date to be either a saturday or sunday?
Start | End |
12may2010 | 30jan2011 |
10jun2008 | 15jul2010 |
So far I have written:
Code:
ge rdate = start - round(runiform() * (end-start))
Is there a way to restrict the random date to be either a saturday or sunday?
Comment