[EpiData-list] Re: EpiData-list Digest, Vol 67, Issue 6

epidata-list at lists.umanitoba.ca epidata-list at lists.umanitoba.ca
Tue May 19 07:06:14 CDT 2009


Dear Nicki,

if your variables are numbers, why do you use the "string"-function 
which converts the numbers to strings?

<<    LET 
MEMID=String(LOCALITY*1000000000)+String(VILLAGECOD*1000000)+String(HHOLDCODE*1000)+String(MEMBERNO)  
 >>

If you just multiply and add the 4 variables as numbers, the result will 
be a number with 10 digits (including zeros):

    LET 
MEMID=(LOCALITY*1000000000)+(VILLAGECOD*1000000)+(HHOLDCODE*100)+(MEMBERNO)

Regards
Juergen

epidata-list at lists.umanitoba.ca schrieb:
> Dear Juergen (and all),
>
> Thanks for your help.
> I want the MEMID to be automatically created after MEMBERNO has been 
> entered. 4 variables will be entered, and the MEMID must be an 
> agreggation of these 3 variables. So this is how the chk file command 
> currently looks:
>
> MEMBERNO
>   RANGE 0 99
>   MUSTENTER
>   AFTER ENTRY
>     LET 
> MEMID=String(LOCALITY)+String(VILLAGECOD)+String(HHOLDCODE)+String(MEMBERNO) 
>
>   END
> END
>
> The MEMID must be 10 digits long, which means that the other variables 
> must be a certain length, and therefore 'keep their zeros' at the 
> beginning.
>
> For example:
> LOCALITY = 1 (must be 1 digit)
> VILLAGECOD = 023 (must be 3 digits)
> HHOLDCODE = 0014 (must be 4 digits)
> MEMBERNO = 12 (must be 2 digits)
>
> Juergen, I tried to include what you suggested within the brackets but 
> in this case, the MEMID simply didn't appear. This is how it looked:
>
> MEMBERNO
>   RANGE 0 99
>   MUSTENTER
>   AFTER ENTRY
>     LET 
> MEMID=String(LOCALITY*1000000000)+String(VILLAGECOD*1000000)+String(HHOLDCODE*1000)+String(MEMBERNO) 
>
>   END
> END
>
> Any ideas why this didn't work?
> Your help is very much appreciated!
>
> Thanks again,
>
> Nicki

-------------- next part --------------
A non-text attachment was scrubbed...
Name: info.vcf
Type: text/x-vcard
Size: 213 bytes
Desc: not available
Url : http://lists.umanitoba.ca/pipermail/epidata-list/attachments/20090519/93c7e3fc/info-0001.vcf


More information about the EpiData-list mailing list