SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

Creating a SAS table from a Flat File

Reply
New Contributor
Posts: 2

Creating a SAS table from a Flat File

I am trying to create a SAS table from a flat file while excluding headers. Currently I have set the writer to start on line two. However it still pulls my headers from line one.

 

Is there an easy solution to creating a SAS table from a flat file without reading in headers?

PROC Star
Posts: 8,149

Re: Creating a SAS table from a Flat File

Posted in reply to MatthewKelley

One suggestion: bypass the import task and simply submit the desired code. e.g., if it's 3 numeric columns:

data want;
  infile '/folders/myfolders/testdata.txt' firstobs=2;
  input col1-col3;
run;

Art, CEO, AnalystFinder.com

 

 

Super User
Posts: 23,293

Re: Creating a SAS table from a Flat File

Posted in reply to MatthewKelley

Are you using DI Studio or SAS Base?

 

If you're using SAS BASE you can try the datarow option in PROC IMPORT or FIRSTOBS in a data step.

 

http://documentation.sas.com/?docsetId=proc&docsetTarget=p08ss3c3xtt2qzn1fsma45gyz333.htm&docsetVers...

Respected Advisor
Posts: 4,674

Re: Creating a SAS table from a Flat File

Posted in reply to MatthewKelley

@MatthewKelley

If you're using SAS DI Studio then you need to define the first line to be read on the External File object as shown below.

Capture.JPG

Super User
Super User
Posts: 7,933

Re: Creating a SAS table from a Flat File

Posted in reply to MatthewKelley

Do you mean that you want to ignore the variable names in the first row and have SAS just assign variable names?

Do you mean that your file doesn't have variable names in the first row?

Do you mean that SAS is trying the read the variable names in the first row as part of the data?

Or that you want to find the variable names in a later row?  Perhaps you are reading from some type of report that has one or more report titles before the lines of data?

New Contributor
Posts: 2

Re: Creating a SAS table from a Flat File

Posted in reply to MatthewKelley

Thank you all, I got it to read in properly.

Ask a Question
Discussion stats
  • 5 replies
  • 178 views
  • 0 likes
  • 5 in conversation