Epi Info™ User Guide

Classic Analysis


ASSIGN Command

Use the ASSIGN Command

This command assigns an expression result or the field value to a variable. Variables are usually created with the DEFINE command and assigned a value.

Syntax

ASSIGN <variable> = <expression>
  1. From the Classic Analysis Command Tree, click Variables > Assign. The ASSIGN dialog box opens.

    Figure 9.7: Assign Dialog Box

     

  2. From the Assign Variable drop-down list, select the variable to have a value assigned.
  3. In the =Expression field, create the assignment syntax based on needed data.
  4. Click OK. The code appears in the Program Editor.

Try It

In the following example, the zip code field is a number. To use the zip code in a map, a new zip code variable must be defined and assigned text values.

  1. From the Classic Analysis Command Tree, use the READ command to open the Sample.PRJ project.
  2. From the Form section, click Surveillance.
  3. Click OK.
  4. Click Variables > Display.>--Variables currently available.
  5. Click OK. The variables information appears.
  6. Click Variables > Define. The DEFINE dialog box opens.
  7. In the Variable Name field, create a new variable named Zip2.
  8. Select Text for Variable Type.
  9. Click OK.
  10. From the Classic Analysis Command Tree, click Variables > Assign. The ASSIGN dialog box opens.
  11. From the Assign Variable drop-down list, select Zip2.
  12. In the =Expression field, type the syntax FORMAT(ZipCode,"00000").
    • In this example, the FORMAT function converts the format of the values of the variable ZipCode into text format. Text values are always surrounded by double quotes and assigned to the new Zip2 variable.
  13. Click OK. The code appears in the Program Editor.
  14. Use the DISPLAY command to view variable information.

    Figure 9.8: Variable Information in Program Editor

     

Top