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 (May 2011, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 17 May 2011 13:18:58 -0400
Reply-To:     "Bian, Haikuo" <HBian@FLQIO.SDPS.ORG>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Bian, Haikuo" <HBian@FLQIO.SDPS.ORG>
Subject:      Re: reading text in multiple lines
Comments: To: "L... L..." <mar.lamack@HOTMAIL.COM>
In-Reply-To:  <SNT117-W276A3C833771EED0CE80F4968C0@phx.gbl>
Content-Type: text/plain; charset="us-ascii"

If the raw data is as exactly the way as OP presented, following hard-coding may work for OP;

data want; length var1 $ 50 var2 $ 50 var3 $ 100; infile cards; input; var1=substr(_infile_,6,length(_infile_)-11); input; var2=substr(_infile_,6,length(_infile_)-11); input; var3=substr(_infile_,6); input; var3=catt(var3,' ',substr(_infile_,1,length(_infile_)-5)); put var3=; cards; <td> some text 1 </td> <td> some text 2 </td> <td> some text some text some text some text some text some text some text</td> <td> some text 1 </td> <td> some text 2 </td> <td> some text some text some text some text some text some text some text</td>

; run;

proc print; run;

Regards, Haikuo

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of L... L... Sent: Tuesday, May 17, 2011 12:04 PM To: SAS-L@LISTSERV.UGA.EDU Subject: reading text in multiple lines

Dear all, I need to import a txt file like this:

<td> some text 1 </td> <td> some text 2 </td> <td> some text some text some text some text some text some text some text</td> . . . I need to create three variables: var1: some text 1 var2: some text 2 var3: some text some text some text some text some text some text some text

Please, How can I do this? (sas 9.2)

best regards;

----------------------------------------- Email messages cannot be guaranteed to be secure or error-free as transmitted information can be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The Centers for Medicare & Medicaid Services therefore does not accept liability for any error or omissions in the contents of this message, which arise as a result of email transmission.

CONFIDENTIALITY NOTICE: This communication, including any attachments, may contain confidential information and is intended only for the individual or entity to which it is addressed. Any review, dissemination, or copying of this communication by anyone other than the intended recipient is strictly prohibited. If you are not the intended recipient, please contact the sender by reply email and delete and destroy all copies of the original message.


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