Agriculture Reference
In-Depth Information
The first command generates a new variable of observations all
with the value 1. The expandcl command expands the dataset to
the number of clusters (4), which is indicated by cluster (id) , in
this case a single value. If the id variable had more than one value,
this command would assume that each value of id represented a
different cluster. The dataset has 20 observations all with the same
value for id, hence, the 4 expands the dataset to 80 observations. The
generate (ident) option, which is part of the expandcl com-
mand, generates a new variable with each new observation labeled
1-4. Finally, when the dataset is sorted by the ident and block
variables, the dataset consists of 80 observations sorted into four
groups of the block totals.
This dataset is now ready to merge with the treatments from the
original dataset. Enter the command
merge 1:1 _n using “Lattice design.dta”, keepusing(trt)
This merges the trt variable from the Lattice design.dta into the cur-
rent dataset in memory (to see this dataset, it is available on the disk as
Block Treatment merge.dta). The merge 1:1 _ n command indicates
it is a 1:1 merge by observations. If you open the Data Editor, you will
notice another variable called _ merge . This variable indicates if the
corresponding observation is from the dataset in memory (called the
master dataset) or from the dataset on disk (called the using dataset).
If the value is 1, then it is from the master dataset, and if it is 2, it is
from the using dataset. The value in this case should all be 3 indicating
the observations are from both the master and using datasets. There
also can be 4 or 5 indicating missing updated or nonmissing conflict,
respectively. Now the dataset should be collapsed again as follows:
collapse (sum) tiller, by (trt)
The name of the variable tiller should be changed to something
else so that it does not conflict with the next command, e.g., btiller .
This is important so the next command will work properly. To change
the name, enter
rename tiller btiller
Search WWH ::




Custom Search