renaming string variables into numeric variables

renaming string variables into numeric variables

Post by sadie pica » Sun, 09 Jul 2006 03:06:03


We need to change string ID variable (p2-001) to numeric (001). Anyone
know syntax for this?

thank you

sarah
 
 
 

renaming string variables into numeric variables

Post by Russ Sande » Sun, 09 Jul 2006 14:56:46

compute numid = num(stringid,f10.0).

 
 
 

renaming string variables into numeric variables

Post by SGer » Mon, 10 Jul 2006 00:46:48

If you need to strip off the "p2-" portion of your string, you need to
do it like Russ said but also take the substring of "stringid" as
follows:

compute numid=num(substr(stringid,4,3),f10.0).