# Defining new variables and assign value using EPIinfo version 3.5.4

This question was posted the Assessment forum area and has 6 replies. You can also reply via email – be sure to leave the subject unchanged.

### Anonymous 81

Public Health Nutritionist

Normal user

8 Mar 2013, 15:50

One of my questions has 17 variables. So as to dichotomize these 17 variables (1,0) I have created new variable (define) but have difficulty to assign the value. the EPIinfo is user friendly as it has separate box to write the "if", "then", and "else" questions. however, when I tried few variables, it works but when I use all of them at once it doesn't. it reads as follow “type of problem: 3075 – expression too complex in query expression”.

For your information, here is the example how i used

DEFINE TRY NUMERIC

IF A=1 OR B=1 OR C=1 OR D=1 OR E=1 OR F=1 OR G=1 OR H=1 OR I=1 OR J=1 OR K=1 OR L=1 OR M=1 OR N=1 OR O=1 OR P=1 OR Q=1 THEN TRY=1 ELSE TRY=0

### Anonymous 2206

Independent consultant

Normal user

8 Mar 2013, 17:04

Indeed Epi Info sometimes finds some analysis commands too complex to be run at once. Try the following:

DEFINE TRY1

IF A=1 OR B=1 OR C=1 OR D=1 OR E=1 OR F=1

THEN TRY1=1 ELSE TRY1=0 END

DEFINE TRY2

IF G=1 OR H=1 OR I=1 OR J=1 OR K=1 OR L=1

THEN TRY2=1 ELSE TRY2=0 END

DEFINE TRY3

IF M=1 OR N=1 OR O=1 OR P=1 OR OR Q=1

THEN TRY3=1 ELSE TRY3=0 END

DEFINE TRY

IF TRY1=1 OR TRY2=1 OR TRY3=1

THEN TRY=1 ELSE TRY=0 END

But be careful because if you have missing data, these will be included in the 'else' and in the denominator. Hence you may need to add the following if any missing value needs to be excluded:

IF A=(.) OR B=(.) OR C=(.) OR D=(.) OR E=(.) OR F=(.)

THEN TRY1=(.) END

IF G=(.) OR H=(.) OR I=(.) OR J=(.) OR K=(.) OR L=(.)

THEN TRY2=(.) END

IF M=(.) OR N=(.) OR O=(.) OR P=(.) OR OR Q=(.)

THEN TRY3=(.) END

IF TRY1=(.) OR TRY2=(.) OR TRY3=(.)

THEN TRY=(.) END

I suspect that the above will be still be too complex for Epi Info so what you need to do is divide the above commands into steps. After running Step 1 for example (let's say from defining TRY 1 to TRY 2), then you write (export) the data table under a new name in Epi info format in the mdb file you are working on. Then, you read (import) the data table back into Epi Info and you continue with Step 2 and defining the additional variables (TRY3 and TRY) for example etc. Basically, you cannot have too many complex 'temporary' variables in one data table at one time and you need to save these complex variables as you go along if you don't want it to crash. Hope this will help! Good luck.

### Kevin Sullivan

Professor

Normal user

8 Mar 2013, 17:05

You are probably using Epi Info 3.5.3? Complex expressions cause problems in the Epi Info 3.. series. Try this:

*Define and Assign a variable to add up the 17 variables

DEFINE TR

ASSIGN TR = A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q

*If TR has a value of 1 or larger, TRY is 1 - else is 0

DEFINE TRY

IF TR >= 1 THEN

TRY = 1

ELSE

TRY = 0

END

### Anonymous 2206

Independent consultant

Normal user

9 Mar 2013, 11:26

The way you handle missing data all depends on the indicator you are calculating. For example, if you are calculating exclusive breastfeeding and if one of the answers is missing for a child for the liquids taken the previous day, it is much better to exclude that child from the EBF analysis. Hence in that example, you wouldn't want to assign a 'No' or '0' for the missing answer of that child because otherwise that child would be included in the analysis which may bias results.

Kevin Sullivan's PGM is obviously much simpler and better than the one I proposed! So if you use that PGM and want to exclude any record (child) with a missing value for these variables when calculating the indicator, you would need to add the following (it would be great if this can be confirmed by Kevin! Thanks!):

IF A=(.) OR B=(.) OR C=(.) OR D=(.) OR E=(.) OR (F)=(.) OR (G)=(.) OR (H)=(.) OR (I)=(.) OR (J)=(.) OR (K)=(.) OR (L)=(.) OR (M)=(.) OR (N)=(.) OR (O)=(.) OR (P)=(.) OR (Q)=(.)

THEN TRY=(.) END

### Anonymous 730

Nutrition and Food Security Officer

Normal user

9 Mar 2013, 20:08

Just to add that the latest PGM for handling missed responses should also be done step by step.Given that you have A to O,you could have A to E then F to J etc.

I hope its clear.