BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sundeep23
Obsidian | Level 7
I am reading a sas program in to a dataset which has multiple blanks when I use compbl it's not compressing the multiple blanks to single blanks any ideas on how to approach?
1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

Try replacing tabs with spaces before applying compbl

 

newStr = compbl(translate(str, ' ', '09'x));
PG

View solution in original post

5 REPLIES 5
PGStats
Opal | Level 21

Try replacing tabs with spaces before applying compbl

 

newStr = compbl(translate(str, ' ', '09'x));
PG
sundeep23
Obsidian | Level 7
Thanks pgstats works like a charm ... why do we need to do that compbl can't find spaces automatically?
PGStats
Opal | Level 21

Well, technically, tabs are not spaces; although I can't see a good reason why compbl shouldn't compress tabs too.

PG
ballardw
Super User

Tab characters are not blank characters. TABS may  appear as spaces depending on software and how it treats tabs but they are not the same as the character blank generated by pressing a space bar.

sundeep23
Obsidian | Level 7
Thanks you all for the info:)

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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
  • 5 replies
  • 2906 views
  • 2 likes
  • 3 in conversation