- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 03-21-2006 07:32 AM
(2131 views)
Hi!
How do you write the 'length' statement in the expression builder? Can it be used when you have a character column?
How do you write the 'length' statement in the expression builder? Can it be used when you have a character column?
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Are you trying to calculate the length of the character value? If so, you can use an expression like this in your calculated column:
LENGTHC( )
For example, if you want to calculate the length of each Name value in SASHELP.CLASS, use this:
LENGTHC(Name)
If you want to make sure that trailing blanks aren't counted, use this:
LENGTHC(TRIM(Name))
Chris
LENGTHC(
For example, if you want to calculate the length of each Name value in SASHELP.CLASS, use this:
LENGTHC(Name)
If you want to make sure that trailing blanks aren't counted, use this:
LENGTHC(TRIM(Name))
Chris
Register for SAS Innovate 2025!! The premier event for SAS users, May 6-9 in Orlando FL. Sign up now for the best deals!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If I understand the question correctly, you can either force the length with a put statement:
put( scan(VAR,1), $32.)
or (possibly; untested) add the length after the expression
scan(VAR,1) length = 32