<?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: Delimiter-based pointer control in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Delimiter-based-pointer-control/m-p/6087#M2438</link>
    <description>Thanks.  Your idea worked well for me after tweaking it a bit.  Here's what I ended up with:&lt;BR /&gt;
&lt;BR /&gt;
data work.a (drop=i cell);&lt;BR /&gt;
	infile "delimited.txt" dlm='09'X dsd missover lrecl=2048;&lt;BR /&gt;
	do i = 1 to 71;&lt;BR /&gt;
		input cell :$16. @;&lt;BR /&gt;
		if i = 13 then Identifier = cell;&lt;BR /&gt;
		if i = 71 then Value = input(cell, 8.);&lt;BR /&gt;
	end;&lt;BR /&gt;
	output;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Still, I thought there was a way to move the pointer by a number of delimiters so that this could all be written as one input statement (no loops or if-then steps).</description>
    <pubDate>Fri, 28 Dec 2007 19:03:33 GMT</pubDate>
    <dc:creator>1162</dc:creator>
    <dc:date>2007-12-28T19:03:33Z</dc:date>
    <item>
      <title>Delimiter-based pointer control</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Delimiter-based-pointer-control/m-p/6085#M2436</link>
      <description>I have a tab delimited file with 116 variables in it.  I only need the 13th and 71st variables for the project I'm doing.&lt;BR /&gt;
&lt;BR /&gt;
Is there some way to skip 12 tabs and then read in a variable?  I came up with this solution, but I'm hoping there is a better one.  &lt;BR /&gt;
&lt;BR /&gt;
data work.in;&lt;BR /&gt;
	infile "delimited.txt" dlm='09'X dsd missover;&lt;BR /&gt;
	input @'09'X @'09'X @'09'X @'09'X @'09'X @'09'X @'09'X @'09'X @'09'X @'09'X @'09'X @'09'X Identifier :$16.;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
I would have to put in 57 more @'09'Xs to read in my next variable.  I don't want to use dummy variables that I later drop because the columns are a mix of character and numeric formats of varying lengths.  &lt;BR /&gt;
&lt;BR /&gt;
Thanks.</description>
      <pubDate>Fri, 28 Dec 2007 17:43:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Delimiter-based-pointer-control/m-p/6085#M2436</guid>
      <dc:creator>1162</dc:creator>
      <dc:date>2007-12-28T17:43:38Z</dc:date>
    </item>
    <item>
      <title>Re: Delimiter-based pointer control</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Delimiter-based-pointer-control/m-p/6086#M2437</link>
      <description>just thinking out loud, but you might try a do loop?&lt;BR /&gt;
&lt;BR /&gt;
*this is pseudo code;&lt;BR /&gt;
array var(116);&lt;BR /&gt;
do i = 1 to 116;&lt;BR /&gt;
  input var(i) @;&lt;BR /&gt;
  if i in (13, 71);&lt;BR /&gt;
end;</description>
      <pubDate>Fri, 28 Dec 2007 18:31:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Delimiter-based-pointer-control/m-p/6086#M2437</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-12-28T18:31:13Z</dc:date>
    </item>
    <item>
      <title>Re: Delimiter-based pointer control</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Delimiter-based-pointer-control/m-p/6087#M2438</link>
      <description>Thanks.  Your idea worked well for me after tweaking it a bit.  Here's what I ended up with:&lt;BR /&gt;
&lt;BR /&gt;
data work.a (drop=i cell);&lt;BR /&gt;
	infile "delimited.txt" dlm='09'X dsd missover lrecl=2048;&lt;BR /&gt;
	do i = 1 to 71;&lt;BR /&gt;
		input cell :$16. @;&lt;BR /&gt;
		if i = 13 then Identifier = cell;&lt;BR /&gt;
		if i = 71 then Value = input(cell, 8.);&lt;BR /&gt;
	end;&lt;BR /&gt;
	output;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Still, I thought there was a way to move the pointer by a number of delimiters so that this could all be written as one input statement (no loops or if-then steps).</description>
      <pubDate>Fri, 28 Dec 2007 19:03:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Delimiter-based-pointer-control/m-p/6087#M2438</guid>
      <dc:creator>1162</dc:creator>
      <dc:date>2007-12-28T19:03:33Z</dc:date>
    </item>
    <item>
      <title>Re: Delimiter-based pointer control</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Delimiter-based-pointer-control/m-p/6088#M2439</link>
      <description>glad to see it worked out for you!&lt;BR /&gt;
&lt;BR /&gt;
i think the only way to selectively read variables is if the file is fixed-width? otherwise, you need to read everything on the line up to the last variable you want to keep.</description>
      <pubDate>Fri, 28 Dec 2007 20:58:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Delimiter-based-pointer-control/m-p/6088#M2439</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-12-28T20:58:13Z</dc:date>
    </item>
    <item>
      <title>Re: Delimiter-based pointer control</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Delimiter-based-pointer-control/m-p/6089#M2440</link>
      <description>that approach uses a loop in the data step iteration over which you can improve, just a little.&lt;BR /&gt;
The "input" statement allows some economy of syntax/processing by using variable lists, like in this example :[pre]&lt;BR /&gt;
data reduced( keep= identifier value ) ;&lt;BR /&gt;
  length dum1-dum70 $1 ;&lt;BR /&gt;
  informat identifier $16. value 8.;&lt;BR /&gt;
  infile "delimited.txt" dsd dlm= '09'x truncover lrecl= 2048 ;&lt;BR /&gt;
  input dum1-dum12 identifier dum14-dum70 value ;&lt;BR /&gt;
run;[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Happy New Year&lt;BR /&gt;
&lt;BR /&gt;
PeterC</description>
      <pubDate>Wed, 02 Jan 2008 12:51:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Delimiter-based-pointer-control/m-p/6089#M2440</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-01-02T12:51:16Z</dc:date>
    </item>
  </channel>
</rss>

