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 (September 2004, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sun, 5 Sep 2004 12:38:41 -0400
Reply-To:     Peter Crawford <peter.crawford@BLUEYONDER.CO.UK>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Peter Crawford <peter.crawford@BLUEYONDER.CO.UK>
Subject:      Re: Help!!!
Comments: To:

On Sun, 5 Sep 2004 13:57:12 +0800, Rex.Lv <> wrote:

>Hi, > >I want to read some data from some txt format files with tab as the >delimiter and every variable value is quoted (even numeric variables), >example in attachment. >Anyone could give me a hand? Thx. a lot! > > > >Best Regards, >Rex. > > >begin 666 AST.TXT >M(DUI:V4B"2(P-S4P,#$B"2)-(B -"B)*86-K(@DB,#<S,# Q(@DB32(-"B)+ >H:71E(@DB,#<W,# Q(@DB1B(-"B)1=6YS(@DB,#<Y,# R(@DB32(-"@`` >` >end

Hi Rex you're in luck because you're using SAS and the SAS system expects data like yours, normally, so, try data what_you_want; infile 'what_you_have.txt' dsd dlm='09'x lrecl= 10000; length char_var $40 num_var 8; informat date_var mmddyy8. amount comma19.2 perc_var percent10. ; * etc; input char_var date_var perc_var num_var amount ; run;

That DSD option on the infile statement, expects to tolerate quoted values of any type. You would expect amount 12,345.67.89 to be quoted if you use comma delimiters, so that needs to be supported, even when your delimiter is tab = '09'x. The lrecl= option is frequently important, because the default, 256 is often too short. As long as you prepare beforehand, your input statement needs only to list the vars you want to read, in order.

Good Luck Peter Crawford P.S. sas-l doesn't allow attachments

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