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 (November 1996, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 8 Nov 1996 10:09:00 EST
Reply-To:     "Kasperovic, Nicholas" <NKaspero@VITGCAB1.TELSTRA.COM.AU>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         "Kasperovic, Nicholas" <NKaspero@VITGCAB1.TELSTRA.COM.AU>
Subject:      Re: Read an external text file to SAS
Comments: To: W HU <whu@UVIC.CA>

Weimin,

Try the following, I think it will do the job for you.

DATA fred; ARRAY myvar(*) $ 128 var1-var5; INFILE CARDS DSD DLM=','; INPUT Var1 Var2 Var3 Var4 Var5; DO i = 1 TO DIM(myvar); myvar(i) = compress(myvar(i),'"'); END; CARDS; "AB","BC","CD","1234","2345" "ab","bc","cd","98765432","09847563" ;

PROC PRINT; RUN;

Regards, Nick KASPEROVIC NKASPERO@VITGCAB1.TELECOM.COM.AU Melbourne, AUSTRALIA >From: W HU >To: Multiple recipients of list SAS-L >Subject: Read an external text file to SAS >Date: 8 November 1996 6:47 > > >Hello, SAS friends; > >I am trying to read an external text file into SAS. The file layout looks >like follows: > >Var1 Var2 Var3 Var4 Var5 > >"AB","BC","CD","1234","2345" >"ab","bc","cd","98765432","09847563" >...... > >The lengths of some variables are very long. For instance, Var2 could be >128 in length, and Var3 could be 256 in length. > >In my infile statement, I was using delimiter=',' and lrecl=550, and using >list input. However, the output I got was incorrect. One of the problems >is that the quotes " were also read into the SAS dataset. Therefore, the >values of some variable were ". > >Could somebody help me regard this. Thanks in advance. > > > >Regards; > >Weimin Hu


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