Agriculture Reference
In-Depth Information
the Strontium.dta. The next forvalues statement loops from 1 to
the number of treatments and is nested inside the previous loop. This
means that for each loop of the forvalues z loop, the forvalues
i loop is completed. For the Strontium.dta, this means the inside
loop ( forvalues i) is executed five times before the next time the
forvalues z loop is executed. The inside loop ( forvalues i) has
a decision statement within it. Decision statements have the general
format as covered in the previous chapter:
if exp {
additional commands
}
else {
additional commands
}
he if command evaluates the following expression to determine
if it is true or false. If the statement is true, then the commands within
the braces are executed; otherwise they are skipped. The else com-
mand is not necessary unless there are alternate commands to execute.
As with the forvalues statement, a { brace must appear on the
same line as the if statement and there must be a corresponding }
brace on a line by itself.
This decision statement
if `test`z'' < `depend'[`i'] {
tests whether the value `test`z'' is less than the ` d e p e n d'[`i']
value. If the value is lower than the macro v,`z' is incremented by
one, which represents the number of means that do not differ. It may
be worth it at this point to take a closer look at the values in this loop.
Remember, macros that appear in open and closed quotes return the
value stored there. So, for example, with `test`z'' , we are deal-
ing with test5, test4, test3, and test2 as calculated values from the
statement
local test`z' = `depend'[`z'] - `S'
Because depend is one of the variables from our dataset, to access
the individual values in this variable, the [] brackets are used to
Search WWH ::




Custom Search