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 2009, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 11 Sep 2009 01:46:48 -0700
Reply-To:     Amar Mundankar <amarmundankar@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Amar Mundankar <amarmundankar@GMAIL.COM>
Organization: http://groups.google.com
Subject:      Re: How to read only one column out of 10 columns in a file
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=ISO-8859-1

On Sep 11, 12:52 pm, Pobel <pobelgol...@gmail.com> wrote: > On Sep 11, 2:33 pm, Amar Mundankar <amarmundan...@gmail.com> wrote: > > > > > Hi All, > > There is a file "test.txt" which has the location as "c:\test.txt". > > It contains 2 records. There are total 10 columns. > > Now I want the value of only the 4 th column from that file without > > reading the complete record. Consider all the columns as Character. > > > Data of the file "test.txt" is as follows. > > aaaaa 22222 bbbbbb 33333 555555 8888 99999 444 ccccc 777777 > > ffffff 66666 111111 sssssss 2222222 hhhhhh gggggg kkkkkkk 9999999 > > rrrrrr > > > The output should be: > > > 33333 > > sssssss > > > Thanks in Advance. > > > Regards, > > Amar. > > Try this: > > data test; > infile "c:\test.txt"; > input @; > var=scan(_infile_,4); > run;

Thanks Pobel, That solution worked perfectly for me.


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