LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 2004, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 9 Dec 2004 10:47:39 -0500
Reply-To:     Jim Groeneveld <jim1stat@YAHOO.CO.UK>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Jim Groeneveld <jim1stat@YAHOO.CO.UK>
Subject:      Re: Q on extracting data from a variable
Comments: To: Rahul Chahal <rahulchahal@YAHOO.COM>
Content-Type: text/plain; charset=ISO-8859-1

Hi Rahul,

It depends. If Acct is a txt file, you'll have to read it with DLM=' -' on the INFILE statement and _no_ DSD option, and a usual INPUT statement.

If, as I suspect, those are the contents of a character variable, you could: Acct1 = INPUT ( SCAN ( Acct, 1, ' -' ) , BEST12. ); and similar for Acct2 and Acct3 (1 becomes 2, resp. 3), which you could code just once in a DO loop (with a 3-element array), or a macro %DO loop.

Regards - Jim. -- Y. (Jim) Groeneveld, MSc., Biostatistician, Science Team Vitatron B.V., Meander 1051, 6825 MJ Arnhem P.O.Box 5227, 6802 EE Arnhem, the Netherlands Tel: +31/0 26 376 7365, Fax: +31/0 26 376 7305 Jim.Groeneveld_AT_Vitatron.com (replace _AT_ by AT sign) http://www.vitatron.com, http://home.hccnet.nl/jim.groeneveld

On Thu, 9 Dec 2004 07:06:39 -0800, RAHUL CHAHAL <rahulchahal@YAHOO.COM> wrote:

>Hi, >Would like to find out how to extract the following values of a variable: > >Acct >1 - 1111 - 123456 >1 - 121212 - 9876543 >1 - 21212 - 909045600 >99 - 32435465 - 121 > >Into 3 variables: > >Acct1 Acct2 Acct3 >1 1111 123456 >1 121212 9876543 >1 21212 909045600 >99 32435465 121 > >Thanks for your help. > >Rahul > > > > > > >--------------------------------- >Do you Yahoo!? > Meet the all-new My Yahoo! Try it today!


Back to: Top of message | Previous page | Main SAS-L page