Skip directly to search Skip directly to A to Z list Skip directly to navigation Skip directly to site content Skip directly to page options
CDC Home


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.


 

Contact Us:
  • Epi Info™ Help Desk
    Centers for Disease Control and Prevention
    1600 Clifton Rd
    Mail Stop E-91
    Atlanta, GA 30333
  • 404-498-6190
    Monday-Friday, 8:30 a.m. - 4:30 p.m. (Eastern Standard Time)
  • epiinfo@cdc.gov
  • Page last updated: June 6, 2012
  • Page created: June 6, 2012
  • Content source: Epi Info™
USA.gov: The U.S. Government's Official Web PortalDepartment of Health and Human Services
Centers for Disease Control and Prevention   1600 Clifton Rd. Atlanta, GA 30333, USA
800-CDC-INFO (800-232-4636) TTY: (888) 232-6348 - Contact CDC–INFO
A-Z Index
  1. A
  2. B
  3. C
  4. D
  5. E
  6. F
  7. G
  8. H
  9. I
  10. J
  11. K
  12. L
  13. M
  14. N
  15. O
  16. P
  17. Q
  18. R
  19. S
  20. T
  21. U
  22. V
  23. W
  24. X
  25. Y
  26. Z
  27. #