To extract a portion of a string, we can use the - substr - command. My variable is numeric, so this command doesn't work. So I used the - tostring - command in order to use the - substr - command afterwards. I did as below and I don't know why I got the r(109) error.
tostring cod_proc, replace
replace gp_proc = substr(cod_proc,1,1)
destring cod_proc gp_proc, replace
But, anyway, it would be better for me to use a command for numeric variable once my dataset is big and it takes a long time to "tostring" the cod_proc variable. Any suggestions?
tostring cod_proc, replace
replace gp_proc = substr(cod_proc,1,1)
destring cod_proc gp_proc, replace
But, anyway, it would be better for me to use a command for numeric variable once my dataset is big and it takes a long time to "tostring" the cod_proc variable. Any suggestions?
Comment