Hello. I'm trying to print my integers as strings (because I want to concatenate them with the word " days"). So when I do:
COMPUTE temp/A12 = EDIT(numDays)| ' days';
my result looks like:
"00015 days" instead of "15 days". I tried making a temporary field in define, such as:
myNum/P7S = numDays;
and then putting that into EDIT. Still same leading zeros. Please help.
You need to provide the Edit mask.
So if the integer is 2 digits and 3 leading zeros to ignor..
where the $ are ignored, and the 9's are selected.
Take a look at the TRIM function and its possible use on an intermediate variable.
Unfortunately, I cannot use the Mask - my number of days can vary from 1 to 7 digits long, and can also be negative.
TRIM function? Where can I find documentation for that? Thanks.
TRIM is a function and is located in the Using Functions manual.
If you don't have the manual, here's the syntax:
TRIM(trim_where, string, string_length, pattern, pattern_length,outfield)
trim_where (alphanumeric) = L for leading, T for trailing, B for both
string (alphanumeric) = source character string enclosd in single quotes, or the field containing the string
string_length (integer) = length of string in characters
pattern (alphanumeric) = pattern to remove enclosed in single quotes
pattern_length (integer) = number of characters in pattern
outfield (alphanumeric) = field where the result is returned, or the format of the ouput value enclosed in single quotes
Hope this helps.
ITEMP/I8 = 00000108; or ITEMP/I8=108; same result
CTEMP/A15=BTEMP || ' ' | 'days';
and CTEMP is then '108 days'
This works; Icky, but works;
FTOA is 'floating point to alpha' and is on page 9-6 in the manual "Using Functions"
FTOA worked! Thanks for all your help.
(I do not have a copy of the manual, and I have not been able to find complete documentation online; that's why I did not know about FTOA or how it worked)
|Powered by Social Strata|