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 (April 2009, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 28 Apr 2009 11:58:04 -0700
Reply-To:     "Schwarz, Barry A" <barry.a.schwarz@BOEING.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Schwarz, Barry A" <barry.a.schwarz@BOEING.COM>
Subject:      Re: How to read Nth column in a file using Infile ????
In-Reply-To:  <51c5fae0-49dd-4f6e-9f67-64d58454ab8e@j9g2000prh.googlegroups.com>
Content-Type: text/plain; charset="us-ascii"

If, as your title suggests, N can vary from run to run, one simple approach is to read the entire record (or use _infile_) and select the Nth "word" using SCAN.

By the way, file "variables" don't have names that SAS knows about. Since you mentioned infile, I assume you are not talking about variables in observations within a SAS data set.

-----Original Message----- From: pinu Sent: Tuesday, April 28, 2009 6:55 AM To: SAS-L@LISTSERV.UGA.EDU Subject: How to read Nth column in a file using Infile ????

Suppose, there is a file containing data as: id mark1 mark2 mark3 /*This line is just for reference and it not part of a file*/ 001 60 70 90 002 85 55 95

Now I want to read data only from column number 2 . Also we don't know the column name. Is there any way to specify column number in Infile statement. ?????? The data is of varying length, we don't know the exact starting column number of variable mark2, So we can not use @ input pointer also.

Please help........

If the above question is not clear, I would like to reframe the question.

If a file contains 100 variables and I want to read the data of 80th variable and I dont know its name. How can we directly read the data of 80th column ???????


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