Quoting downstream values ββin Stata using forvalues
So this works as expected:
. forvalues i = 1(1)3 { 2. di `i' 3. }
1
2
3
And it is not:
. forvalues i = 3(1)1 { 2. di `i' 3. } <--- that an empty line that returns from the above loop.
If I want to create
3 2 1
Do I really need this to be explored?
. forvalues i = 1(1)3 { 2. di 3+1-`i' 3. }
Why?
+3
Alexis
source
to share
1 answer
Your cycle should begin
forv i = 3(-1)1
since your step is -1
not 1
.
+5
Nick cox
source
to share