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,927

Re: Compbl

Posted in reply to sundeep23

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,927

Re: Compbl

Posted in reply to sundeep23

Try replacing tabs with spaces before applying compbl

 

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

Re: Compbl

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

Re: Compbl

Posted in reply to sundeep23

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: 11,343

Re: Compbl

Posted in reply to sundeep23

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

Posted in reply to sundeep23
Thanks you all for the infoSmiley Happy
🔒 This topic is solved and locked.

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

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