Date: Tue, 2 Feb 1999 15:21:17 GMT
Reply-To: Sally@bindword.demon.co.uk
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Shiling Zhang <shiling@MATH.WAYNE.EDU>
Organization: Deja News - The Leader in Internet Discussion
Subject: Re: put and substring function
Sally,
Two functions are good to know 'trim' and 'left'.
Hope this helps.
589 data t1;
590 input var1 $20. var2 ;
591 var3=trim(var1)||trim(left(var2));
592 put var3=;
593 cards;
NOTE: Numeric values have been converted to character
values at the places given by: (Line):(Column).
591:28
VAR3=ABC001 011 0031
VAR3=ABC001 011 0022
VAR3=ABC001 011 0063
VAR3=ABC001 011 0024
VAR3=ABC001 011 0015
NOTE: The data set WORK.T1 has 5 observations and 3 variables.
NOTE: DATA statement used:
real time 0.18 seconds
cpu time 0.08 seconds
599 ;
In article <917905137.6385.0.nnrp-02.c2defdbe@news.demon.co.uk>,
"Sally McDonald" <Sally@bindword.demon.co.uk> wrote:
> Dear Usergroup,
>
> I have two variables:
>
> var1 var2
> ABC001 011 003 1
> ABC001 011 002 2
> ABC001 011 006 3
> ABC001 011 002 4
> ABC001 011 001 5
>
> I want to put the numeric values of var2 in place of the end numeric value
> of var1. Im thinking along the lines of something like:
>
> put(substr(var1,15,1),var2,3.)
>
> Although I know this doesn't work. Can anyone offer a method on how to do
> this?
>
> Sal
>
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
|