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-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

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
  • 519 views
  • 0 likes
  • 2 in conversation