Date: Wed, 2 Dec 2009 06:12:16 -0800
Reply-To: Chris Jones <chrisj75@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Chris Jones <chrisj75@GMAIL.COM>
Organization: http://groups.google.com
Subject: Re: Scan function
Content-Type: text/plain; charset=ISO-8859-1
On 2 Dec, 13:33, christine.bene...@HOTMAIL.COM (Chris Benefer) wrote:
> I am trying to use SCAN to split a text field with data like
>
> 11 "In particular senior consultants who do not like the "new" medical
> course"
>
> into 2 variables
>
> var1 11
> var2 In particular senior consultants who do not like the "new" medical
> course
>
> I have tried using scan e.g. var2 = scan(var,2,'"');
> I have tried using modifiers to ignore the embedded " to no avail.
>
> Can anyone help
Use scan to get the first part, then substr & length to get the
rest....
var1 = scan(var,1,' ');
var2 = substr(var,length(var1)+1,length(var)-(length(var1))) ;
|