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

Good Morning,

 

I'm wondering if anyone can give me direction on how to remove the state from where my city column is listed. Screen Shot 2020-11-05 at 9.42.25 AM.png

^That is the first data line, I am trying to remove Mississippi and just have Blue Mountain independently. 

 

Here is my code, 

DATA WORK.C;

SET Hyp.C ( KEEP = SocSecNum FirstInit MiddleInit LastInit CityState ZipCd
RENAME = (SocSecNum = SSN )
);

LENGTH Inits $3
City $20
StateCd$2;

Inits = COMPRESS(CATS(FirstInit, MiddleInit, LastInit), '.');

City = SCAN(CityState,1,'.');

Format StateCd $StateCd.;

RUN;

 

This is the first two observations that my code produces:

Screen Shot 2020-11-05 at 9.44.13 AM.png

Thanks in advance for the advice. 

 

Best,

 

Neeloo

1 ACCEPTED SOLUTION
2 REPLIES 2
neeloofar
Fluorite | Level 6

Wow, so simple, I overlooked it, thank you so much!!

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 429 views
  • 0 likes
  • 2 in conversation