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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—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
  • 777 views
  • 0 likes
  • 2 in conversation