Dear all,
I have two variables: seq1 and u.
seq1 is a repeating sequence: 1,2,3,4,5
u is a random integer between 1 and 5, generated by u = 4*uniform() + 1
Now I want to achieve this: when u equals to seq1, do the randomisation again until u has a different value as seq1.
My code is:
foreach var in u{
foreach num in seq1{
while `num' == `var'{
replace `var' = 4*uniform() + 1)
}
}
}
No error in this code but it didn't work for my purpose. After I run it, nothing changed.
So would you mind help me figure out why this code cannot work and what I need to do to achieve my purpose?
Thank you very much!
Related Posts with How to write a while statement for the purpose detailed in the post?
Can we create inverse-distance spatial weighting matrices for point data?Hello, Can we create inverse-distance spatial weighting matrices for point data? I can create inve…
Nested locals in some commandsI constructed two locals, for instance, department and major , to show one's information: Code: loc…
Binary DV unbalanced panel data; replacing first year to missingI have unbalanced panel data of 600000 plus observations. I have created my Dependent Variable as bi…
Panel Co-integration Test:I am running a panel cointegration test using the Pedroni approach. The panel consists of 53 countri…
Table commandHi guys I'm at the beginning of this software I'm running this command to obtain a table with the me…
Subscribe to:
Post Comments (Atom)
0 Response to How to write a while statement for the purpose detailed in the post?
Post a Comment