BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
ccaudillo100
Obsidian | Level 7

Hello, I am wanting to separate the FIPs code into just state and county number. Any advice? 

 

Shown below is what I am wanting 

 

What I haveWhat I want
FIPSStateCounty
5017517
5041541
2010720107
460974697
1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Are those numbers?

data want;
  set have;
  state = int(fips/1000);
  county = mod(fips,1000);
run;

Or strings?

data want;
  set have;
  state=put(int(input(fips,32.)/100),Z2.);
  county=put(mod(input(fips,32.),100),Z3.);
run;

View solution in original post

3 REPLIES 3
ballardw
Super User

Is your current FIPS variable numeric or character? Do you want character or numeric State and County? If character do you want the leading 0 that should be present to avoid confusion?

Tom
Super User Tom
Super User

Are those numbers?

data want;
  set have;
  state = int(fips/1000);
  county = mod(fips,1000);
run;

Or strings?

data want;
  set have;
  state=put(int(input(fips,32.)/100),Z2.);
  county=put(mod(input(fips,32.),100),Z3.);
run;
ccaudillo100
Obsidian | Level 7
For me it was just numeric but both are helpful for me in the future! Thank you so much!

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 375 views
  • 2 likes
  • 3 in conversation