BookmarkSubscribeRSS Feed
varshabansal
Obsidian | Level 7

Hello everyone!

 

I want to remove extra space my text. how to remove that 

output is like this Fsc_acount_dim            .sas  

but i want to be it as fsc_account_dim.sas

 

Thanks in advance!

image.png

5 REPLIES 5
TarunKumar
Pyrite | Level 9
Use compress function
varshabansal
Obsidian | Level 7
use compress getting compress(name .sas)
PaigeMiller
Diamond | Level 26

@varshabansal wrote:
use compress getting compress(name .sas)

I don't know what this means.

--
Paige Miller
Kurt_Bremser
Super User

You cannot use a data step function like that in macro statements. You have to wrap data step functions into a %SYSFUNC call.

But a simple %LET will automatically strip leading and trailing blanks, so this will do:

%let nam=&name.;

if (and that can be a big IF) you really have blanks (hex 20). Other "whitespace" characters are not filtered.

 

In the future, use the proper forum windows (</> and "little running man") to copy/paste the log or program text into. Pictures make it hard for us to use code for testing, or to point out mistakes or places for improvement.

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
  • 5 replies
  • 2069 views
  • 0 likes
  • 4 in conversation