[EpiData-list] Converting string to number

epidata-list at lists.umanitoba.ca epidata-list at lists.umanitoba.ca
Fri Jan 13 09:31:51 CST 2006


In Epi6 I often used the following
define var1 ##
let var1=stringvar[startposition,number ]
to convert a part of a stringvariabel to an integer variable.
Whar is the equivalance in EpiStat?

The way to find this information in EpiData Analysis is the following:
1. press F1 (latest version 1.1)

2. This will either show the complete "commands and functions" reference, 
where a section shows functions or a specific command, if a word in the 
beginning of the command prompt is found as a key word in the commands ref.

The answer to your question can then be found by:
writing in the command prompt: 
functions                  // and then press F1

or by just pressing F1 and look for the functions near the bottom of the file. 

ANswer:
define var1 ##
var1 = string(var2)
*or if you wish only a part of var2:
var1 = string(copy(var2,1,1)) 

or simpler with command "gen"

gen i var1 = string(var2)
*or if you wish only a part of var2:
gen i var1 = string(copy(var2,1,1)) 

"i" stands for integer variable

regards

Jens Lauritsen
EpiData Association, Denmark




functions




More information about the EpiData-list mailing list