<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Working with imported text file in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Working-with-imported-text-file/m-p/36974#M9370</link>
    <description>Yes, you can, using the SAS INPUT function in a variable/column assignment statement; also you would want to use _INFILE_ as the first argument to INPUT.  Also, consider how to access each sub-field, either using SCAN, SUBSTR, FIND, or a combination of these functions.&lt;BR /&gt;
&lt;BR /&gt;
Then, on your DATA step's first DATA step, code each of the output file(s) you want to generate, and explicitly code OUTPUT statement(s) as needed to generate multiple files.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search arguments, this topic / post:&lt;BR /&gt;
&lt;BR /&gt;
data step programming site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
data step "_infile_" site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
data step input function site:sas.com</description>
    <pubDate>Fri, 19 Nov 2010 16:52:02 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2010-11-19T16:52:02Z</dc:date>
    <item>
      <title>Working with imported text file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Working-with-imported-text-file/m-p/36973#M9369</link>
      <description>I'm doing an infile &amp;amp; input statement to read in a big text file.  That part I have working fine&lt;BR /&gt;
&lt;BR /&gt;
data raw ;	&lt;BR /&gt;
	infile 'c:\testtxt' TRUNCOVER;&lt;BR /&gt;
	input text $CHAR100. ;	/*keep leading blanks*/&lt;BR /&gt;
run ;&lt;BR /&gt;
&lt;BR /&gt;
My problem is with the data in the table.  This is the layout of the data:&lt;BR /&gt;
&lt;BR /&gt;
TEST99 This is a test var&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
  def: NUM WIDTH:5 DECIMALS:5&lt;BR /&gt;
  &lt;BR /&gt;
  &lt;BR /&gt;
  This is a test variable.  Looking to see if I can import and select out parts of the file for &lt;BR /&gt;
  further research. Does this work?&lt;BR /&gt;
  (What was is this variable?)&lt;BR /&gt;
  &lt;BR /&gt;
  This variable is used in many ways across this project.  If you look at the test documentation you will&lt;BR /&gt;
  read how you are supposed to use this variable.&lt;BR /&gt;
  &lt;BR /&gt;
  &lt;BR /&gt;
  200  10-20 	Test Value 1&lt;BR /&gt;
  100  30-40 	Test Value 2&lt;BR /&gt;
  245  50-60 	Test Value 3&lt;BR /&gt;
  126  70-80 	Test Value 4&lt;BR /&gt;
  102  90-100 	Test Value 5&lt;BR /&gt;
----------------------------------------------------&lt;BR /&gt;
&lt;BR /&gt;
I need to be able to take each section and put it in it's own table. &lt;BR /&gt;
For instance I would like a table that has just 2 variables one for my range and one for&lt;BR /&gt;
my label.&lt;BR /&gt;
10-20 	Test Value 1&lt;BR /&gt;
30-40 	Test Value 2&lt;BR /&gt;
50-60 	Test Value 3&lt;BR /&gt;
70-80 	Test Value 4&lt;BR /&gt;
90-100 	Test Value 5&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thank you for any help</description>
      <pubDate>Fri, 19 Nov 2010 15:37:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Working-with-imported-text-file/m-p/36973#M9369</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2010-11-19T15:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: Working with imported text file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Working-with-imported-text-file/m-p/36974#M9370</link>
      <description>Yes, you can, using the SAS INPUT function in a variable/column assignment statement; also you would want to use _INFILE_ as the first argument to INPUT.  Also, consider how to access each sub-field, either using SCAN, SUBSTR, FIND, or a combination of these functions.&lt;BR /&gt;
&lt;BR /&gt;
Then, on your DATA step's first DATA step, code each of the output file(s) you want to generate, and explicitly code OUTPUT statement(s) as needed to generate multiple files.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search arguments, this topic / post:&lt;BR /&gt;
&lt;BR /&gt;
data step programming site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
data step "_infile_" site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
data step input function site:sas.com</description>
      <pubDate>Fri, 19 Nov 2010 16:52:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Working-with-imported-text-file/m-p/36974#M9370</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-11-19T16:52:02Z</dc:date>
    </item>
    <item>
      <title>Re: Working with imported text file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Working-with-imported-text-file/m-p/36975#M9371</link>
      <description>Scott,&lt;BR /&gt;
&lt;BR /&gt;
Thank you again for your help.  The _infile_ with the input function makes sense but what i'm having a hard time with is knowing how to grab the text.  I know that under this row&lt;BR /&gt;
&lt;BR /&gt;
"def: NUM WIDTH:5 DECIMALS:5" &lt;BR /&gt;
&lt;BR /&gt;
there are two blank rows then my data starts there and every row after that till another blank row is hit.  Am I able to do that with this logic?  Since I don't know what text is going to be there I can only know where it will start based on the blank rows.  Does this make sense or am I making it more difficult then it needs to be.  &lt;BR /&gt;
&lt;BR /&gt;
Thanks for the help</description>
      <pubDate>Fri, 19 Nov 2010 18:20:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Working-with-imported-text-file/m-p/36975#M9371</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2010-11-19T18:20:41Z</dc:date>
    </item>
  </channel>
</rss>

