BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
HyunJee
Fluorite | Level 6

I have two instances:

First, I have a data set that contains zip code. Most are the typical 5 digits, but I have some that contain the last four, like so:

731101014   (contains the first 5 and last 4, not separated by anything)

731101014

731101014

731101014

73108          (contains only the first five *what I am needing all zip codes to be formatted in)

73108

73108

73108

73108 

73013-0000  (contains the first 5 and last 4, separated by a dash - )

73013-0000

73013-0000

73013-0000

73013-0000

I am on a bit of a time crunch and need any help I can get on how to best write code to only pull out the first 5 numbers from each zip code and ditch the rest.

Thank you for any help you can give!

1 ACCEPTED SOLUTION

Accepted Solutions
HyunJee
Fluorite | Level 6

I figured it out.

Went through some of my old code and decided to do the following:

  zipcode_short = substr(zip,1,5);

Did exactly what I was needing.

Decided to post the answer to my own question in case someone else had a similar one and could use the information.

Thanks!

View solution in original post

1 REPLY 1
HyunJee
Fluorite | Level 6

I figured it out.

Went through some of my old code and decided to do the following:

  zipcode_short = substr(zip,1,5);

Did exactly what I was needing.

Decided to post the answer to my own question in case someone else had a similar one and could use the information.

Thanks!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 778 views
  • 0 likes
  • 1 in conversation