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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 2316 views
  • 2 likes
  • 3 in conversation