I have a variable called GEOID10 in my SAS table which is made up of 10-11 digits. The first 4-5 digits are the State and County FIPS codes and and the last 6 digits are the Census Tract. I want to create a new variable called TACTCE only takes the last 6 digits of the GEOID10, and drops the first 4-5 digits.
Here are some examples of the GEOID10s I'm working with:
1001020700
1001020900
1001020900
1001020900
1001020900
1001021000
56035000102
56037970500
56037971600
56037971600
56037971600
56037971600
56037971600
I have tried the following codes in SAS, however it never starts at the right number.
data My.Data;
set My.Data;
TRACTCE = input(substr(GEOID10, 5), 6.);
run;
This code gave me 10207 instead of 020700 for GEOID10 1001020700.
data My.Data;
set My.Data;
TRACTCE = input(substr(GEOID10, 5, 6), 6.);
run;
This code also gave me 10207 instead of 020700 for GEOID10 1001020700.
data My.Data;
set My.Data;
TRACTCE = input(substr(GEOID10, 5), 10.);
run;
This code also gave me 1020700 instead of 020700 for GEOID10 1001020700.
data My.Data;
set My.Data;
TRACTCE = input(compress(substr(GEOID10, 5),, 'kd'), 10.);
run;
This code also gave me 1020700 instead of 020700 for GEOID10 1001020700.
data My.Data;
set My.Data;
TRACTCE = input(substr(GEOID10, 5, 6), 10.);
run;
This code also gave me 10207 instead of 020700 for GEOID10 1001020700.
data My.Data;
set My.Data;
TRACTCE = put(input(substr(GEOID10, 5, 6), 10.), z6.);
run;
This code also gave me 10207 instead of 020700 for GEOID10 1001020700.