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

Hello,

From the below character_variable I only want to pick the ones with 5 digits:

I want to eliminate the rest. Do I use Substring??

CODE_VARIABLE

10351

101

11223040

32421

10449900

1 ACCEPTED SOLUTION

Accepted Solutions
2 REPLIES 2
Reeza
Super User

Length() function returns the length of a string.

SAS(R) 9.2 Language Reference: Dictionary, Fourth Edition

MadhuKorni
Quartz | Level 8

data Want;

input Code_Variable $;

if length(Code_Variable) eq 5;

cards;

10351

101

11223040

32421

10449900

;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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