![]() |
|
|
|||||||
| FlashChat | Actuarial Discussion | Preliminary Exams | CAS/SOA Exams | Cyberchat | Around the World | Suggestions |
United Kingdom | Canada
| Entry Level |
D.W. Simpson |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
||||
|
||||
|
Is there a
I have two string variables, VAR1 $24. & VAR2 $13.; Sometimes VAR1 = 'HARDY_______________'; /* '_' represents spaces */ But other times VAR1 = 'WONT YOU BE MY NEIGHBOR?'; Additionally, VAR2 = 'HAR HAR______'; But other times VAR1 = 'NOT A CHANCE'; I am concatenating the two vars: VAR3 = VAR1 !! VAR2; The problem is those spaces at then end of VAR1 when VAR1 = hardy____... I want VAR3 = 'HARDY HAR HAR'; not 'HARDY_____________ HAR HAR_______'; This is how I tried to get around it: VAR3 = COMPRESS(VAR1 !! VAR2,'__'); /* '__' represents two spaces. */ SAS ignored the two spaces & and compressed ALL spaces so VAR3 = 'HARDYHARHAR'; There's got to be something out there for this. Maybe a TRIM statement?
__________________
. [this space for rent] |
|
#2
|
||||
|
||||
|
Yes, TRIM worked.
More specifically, VAR3 = TRIM(VAR1) !! '_' !! TRIM(VAR2); /* '_' represents a space. */ /* I had to add a space in between the two otherwise it turned into 'HARDYHAR HAR'. */
__________________
. [this space for rent] |
![]() |
| Tags |
| sas, trim |
| Thread Tools | |
| Display Modes | |
|
|