Hi Folks:
I'm trying to use the beginning part of the string variable (i.e., Albany- or Albany(county) or Albany county) until any of these symbols happen as part of the string: '-', ' ' , '('
The code below does the job but too inefficient.
Is there a way to accomplish this in a single step?
data TEMP; set census_age1;
IDNAME1=substr(IDNAME,1,index(IDNAME,'-')-1);
DROP IDNAME; RENAME IDNAME1=IDNAME;
ID1NAME1=substr(ID1NAME,1,index(ID1NAME,'-')-1);
DROP ID1NAME; RENAME ID1NAME1=ID1NAME;
RUN;
DATA TEMP1; SET TEMP;
IDNAME1=substr(IDNAME,1,index(IDNAME,' ')-1);
DROP IDNAME; RENAME IDNAME1=IDNAME;
RUN;
DATA census_age2; SET TEMP1;
IDNAME1=substr(IDNAME,1,index(IDNAME,'(')-1);
DROP IDNAME; RENAME IDNAME1=IDNAME;
run;
... View more