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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.