Epi Info™ User Guide


Classic Analysis




How to Manage Data: Use the ASSIGN Command

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

Syntax

ASSIGN <variable> = <expression>
<variable> = <expression>

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

 

 

  1. From the Assign Variable drop-down list, select the variable to have a value assigned.
  2. In the =Expression field, create the assignment syntax based on the needed data.
  3. 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.
  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 is used to convert the format of the values of the variable ZipCode into the text format. Text values are always surrounded by double quotes and are 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.


  • Page last updated: June 6, 2012
  • Page created: June 6, 2012
  • Content source: Epi Info™