I'm trying to remove the trailing spaces with the use Strip function as follows, but it is not removing the spaces in the final Output.
Am I missing something?
FNCTL_CMPNT_NM=strip(ifc(indexw("&etls_jobName","_ADP_"),'AP','LIS'));
My Value for FNCTL_CMPNT_NM is 'LIS ' after the execution of the above code.
Hello,
Imagine putting a small item in a large drawer. It won't reduce the size of the drawer.
The same happens here : you affect a small string to a previously large dimensioned string
so FNCTL_CMPNT_NM will contain the stripped string and the rest will be filled with blanks.
I assume the "final output" is what gets into variable FNCTL_CMPNT_NM
With SAS character variables being of type CHAR you will always have strings padded up with blanks up to the length of the character variable so there are in a way always trailing blanks. Nothing you can do about it except to define the variable with a length not longer as you really need it.
Hello,
Imagine putting a small item in a large drawer. It won't reduce the size of the drawer.
The same happens here : you affect a small string to a previously large dimensioned string
so FNCTL_CMPNT_NM will contain the stripped string and the rest will be filled with blanks.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.