Create one variable from two or more variables
Is there a way to automatically create a variable from 2-3 entered variables? For example: I have var1 ###### var2 ## var3 #
I would like epidata entry to automatically populate a new variable for each case, where the value would be var1, var2, var3 appended with each other:
var4 var1var2var3
I tried creating a data check command:
~~~~~~~~~~~~~~~~~~~~~~ var4 MUSTENTER AFTER ENTRY var4="var1" + string(var1) + "var2" + string(var2) + "var3" + string(var3) END END ~~~~~~~~~~~~~~~~~~~~~~~~~ But that did NOT work. Thanks so much J.H.
____________________________________________________________________________________ Sponsored Link
Mortgage rates near 39yr lows. $510k for $1,698/mo. Calculate new payment! www.LowerMyBills.com/lre
Hello,
It seems that several mis-specifications are made in your code:
- first, why don't you declare initially the variables var1 to var3 as string variables? This would help to concatenate them.
- second, if the variables v1-v3 have to be numericals, the creation of the var4 should be something like : var4 = string(var1)+string(var2)+string(var3)
- third, to generate automatically v4 (defined as a string variable) I would have written the following code:
var4 BEFORE ENTRY var4 = string(var1)+string(var2)+string(var3) GOTO var5 (if var5 is the next variable in the QES file) END END
Please note that MUSTENTER may be not appropriate, unless you are sure that there will be no missing variables among v1-v3
Hope this helps
Regards
------------------------------------------------------- Yves MARTIN-PREVEL, Epidemiologist, MD, MSc, PhD Nutrition Unit (WHO Collaborating Center for Nutrition) Institut de Recherche pour le Développement (IRD) 01 BP 182 - OUAGADOUGOU 01 - BURKINA FASO Tel: +226 50 30 67 37; Fax: +226 50 31 03 85 http://www.ird.bf/
epidata-list@lists.umanitoba.ca a écrit :
Is there a way to automatically create a variable from 2-3 entered variables? For example: I have var1 ###### var2 ## var3 #
I would like epidata entry to automatically populate a new variable for each case, where the value would be var1, var2, var3 appended with each other:
var4 var1var2var3
I tried creating a data check command:
var4 MUSTENTER AFTER ENTRY var4="var1" + string(var1) + "var2" + string(var2) + "var3" + string(var3) END END
But that did NOT work. Thanks so much J.H.
Sponsored Link
Mortgage rates near 39yr lows. $510k for $1,698/mo. Calculate new payment! www.LowerMyBills.com/lre _______________________________________________ EpiData-list mailing list EpiData-list@lists.umanitoba.ca http://lists.umanitoba.ca/mailman/listinfo/epidata-list
participants (1)
-
epidata-list@lists.umanitoba.ca