Agriculture Reference
In-Depth Information
Figure 2.11
Dialog for creating new variables.
To develop this randomization, start with an empty Data Editor
(no dataset in memory). In this case, we will need an empty dataset
of 48 missing values. There is no dialog window to do this; it must be
done in the Command area of the Main window. Type the following
in the Command region:
set obs 48
This will create 48 blank rows in the Data Editor. Then generate a
new variable with random numbers. To do this, select the Create new
variable submenu (Figure 2.11).
Data > Create or change variables > Create new variable
Enter a name for this variable in the Variable name: and then enter
runiform() in the Specify a value or an expression field. The runi-
form() function can be selected under the Create… button from
the Random numbers category under Functions (Figure  2.12). The
Create… button to the right of the Specify a value or an expression
field looks a little like a calculator and that is its use. A variety of func-
tions will appear in the right list when different categories in the left
list are selected, as well as math functions and logical operators. This
dialog is used by many different commands.
To set this from the Command window, type
generate x = runiform()
Search WWH ::




Custom Search