Date: Wed, 5 Aug 2009 11:52:40 -0400
Reply-To: Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Subject: Re: adding spaces to make upto 25 characters in length...
first you should define the new_name with length:
data ...
length new_name $25;
then at last step you can use:
substr(new_name,25,1) = "^";
Gerhard
On Wed, 5 Aug 2009 08:39:27 -0700, wes <w.greenhead@GOOGLEMAIL.COM> wrote:
>Hi,
>
>I've got a field that contains peoples names and i need to create a
>new variable that looks like below....where the first 4 characters are
>spaces, followed by a ^ symbol, then the name, then xx number of
>spaces, finally ending with a ^ symbol.
>
>The bit im struggling with is inserting the correct amount of spaces
>after the name so that its a maximum of 25 characters in length
>between the two ^ symbols (as per below)
>
>new_name
> ^GONCALVESOLIVEIRA/MMRS ^
> ^ROCHA/IMRS ^
> ^SIMOESVALADAO/MMRS ^
>
>Hope someone can help me.
>
>Many thanks for your help
>
>Wes
>
>P.S.
>The original name field looks like this...
>GONCALVESOLIVEIRA/MMRS
>ROCHA/IMRS
>SIMOESVALADAO/MMRS
|