DATA Step, Macro, Functions and more

Compbl

Accepted Solution Solved
Reply
Contributor
Posts: 24
Accepted Solution

Compbl

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?

Accepted Solutions
Solution
‎10-07-2015 12:21 PM
Respected Advisor
Posts: 4,654

Re: Compbl

Try replacing tabs with spaces before applying compbl

 

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

View solution in original post


All Replies
Solution
‎10-07-2015 12:21 PM
Respected Advisor
Posts: 4,654

Re: Compbl

Try replacing tabs with spaces before applying compbl

 

newStr = compbl(translate(str, ' ', '09'x));
PG
Contributor
Posts: 24

Re: Compbl

Thanks pgstats works like a charm ... why do we need to do that compbl can't find spaces automatically?
Respected Advisor
Posts: 4,654

Re: Compbl

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

PG
Super User
Posts: 10,521

Re: Compbl

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.

Contributor
Posts: 24

Re: Compbl

Thanks you all for the infoSmiley Happy
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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