Date: Tue, 27 Jul 2004 11:25:47 -0400
Reply-To: "DePuy, Venita" <depuy001@DCRI.DUKE.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "DePuy, Venita" <depuy001@DCRI.DUKE.EDU>
Subject: Re: breaking one variable in SAS
Content-Type: text/plain
Try the substring function.
Data two;
set one;
sex=substr(allsexage,1,1);
age = substr(allsexage,2,2);
proc print;
run;
Side note: general form of substring function is:
substr(matrix or variable, position, length)
HTH
Venita
> ----------
> From: Adriano Rodrigues - Instituto GPP[SMTP:adriano@GPP.COM.BR]
> Reply To: Adriano Rodrigues - Instituto GPP
> Sent: Tuesday, July 27, 2004 11:37 AM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: breaking one variable in SAS
>
> Hi all,
>
> whats the best method to break one var in two?
>
> i have var allsexage with values
> allsexage
> 134
> 245
> 156
> 267
> 156
> 167
> 178
>
> i want to transform in:
> sex age
> 1 34
> 2 45
> 1 56
> 2 67
> 1 56
> 1 67
> 1 78
>
> Thx in advance,
> Adriano
>
|