[EpiData-list] Converting string to number
epidata-list at lists.umanitoba.ca
epidata-list at lists.umanitoba.ca
Tue Jan 17 03:34:39 CST 2006
I tried the solutions given but it didn't work -
purhaps I have made some errors. Here is the printout:
. read
Loading data C:\Data\Test.rec, please wait..
File name : C:\Data\Test.rec
Fields: 1 Total records: 3 Valid records: 3
*******************************************************************************************
NOTE: Test.rec contains the variable var1 (string) and the following cases:
10/01
11/02
11/03
*******************************************************************************************
. Run "C:\DOCUME~1\STIG~1.UHL\LOKALA~1\Temp\TMP67F.Tmp"
. define var2 ##
Var Name VAR2 of type Integer
Var length: 2 decimals 0
. var2 = string(copy(var1,1,2))
Data type mismatch
. close
File closed
. read
Loading data C:\Data\Test.rec, please wait..
File name : C:\Data\Test.rec
Fields: 1 Total records: 3 Valid records: 3
. Run "C:\DOCUME~1\STIG~1.UHL\LOKALA~1\Temp\TMP680.Tmp"
. gen i var2 = string(copy(var1,1,2))
Data type mismatch
------------------------------------------------------------------------
Stig Uhlin tel 090-786 60 71 Stig.Uhlin at umdac.umu.se
UMDAC 070-591 03 04
901 87 Umeå fax 090-786 67 62
------------------------------------------------------------------------
More information about the EpiData-list
mailing list