<?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: Why answer is this? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Why-answer-is-this/m-p/424277#M104463</link>
    <description>&lt;P&gt;The trailing @ holds the record pointer in the current line, so the second input statement re-reads positions 1 and 8; the third and fourth column of the infile are therefore never read.&lt;/P&gt;</description>
    <pubDate>Tue, 02 Jan 2018 07:46:31 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-01-02T07:46:31Z</dc:date>
    <item>
      <title>Why answer is this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-answer-is-this/m-p/424276#M104462</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Given the text file COLORS.TXT:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;----+----1----+----2----+----&lt;/P&gt;&lt;DIV class="rtejustify"&gt;RED&amp;nbsp; &amp;nbsp; ORANGE&amp;nbsp; YELLOW&amp;nbsp; GREEN&lt;/DIV&gt;&lt;DIV class="rtejustify"&gt;BLUE&amp;nbsp; &amp;nbsp;INDIGO&amp;nbsp; &amp;nbsp; PURPLE&amp;nbsp; &amp;nbsp;VIOLET&lt;/DIV&gt;&lt;DIV class="rtejustify"&gt;CYAN&amp;nbsp; &amp;nbsp;WHITE&amp;nbsp; &amp;nbsp; &amp;nbsp;FUCSIA&amp;nbsp; &amp;nbsp; BLACK&lt;/DIV&gt;&lt;DIV class="rtejustify"&gt;GRAY&amp;nbsp; &amp;nbsp;BROWN&amp;nbsp; &amp;nbsp;PINK&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MAGENTA&lt;/DIV&gt;&lt;P&gt;&lt;STRONG&gt;The following SAS program is submitted:&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV&gt;data WORK.COLORS;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;infile 'COLORS.TXT';&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; input @1 Var1 $ @8 Var2 $ @;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; input @1 Var3 $ @8 Var4 $ @;&lt;BR /&gt;run;&lt;/DIV&gt;&lt;P&gt;&lt;STRONG&gt;What will the data set WORK.COLORS contain?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Answer:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;Var1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Var2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Var3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Var4&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;------&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ------&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ------&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;------&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;RED&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ORANGE&amp;nbsp; &amp;nbsp; &amp;nbsp; RED&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ORANGE&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;BLUE&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; INDIGO&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; BLUE&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;INDIGO&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CYAN&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WHITE&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CYAN&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;WHITE&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;GRAY&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; BROWN&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;GRAY&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;BROWN&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2018 07:40:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-answer-is-this/m-p/424276#M104462</guid>
      <dc:creator>mohitraj4u</dc:creator>
      <dc:date>2018-01-02T07:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: Why answer is this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-answer-is-this/m-p/424277#M104463</link>
      <description>&lt;P&gt;The trailing @ holds the record pointer in the current line, so the second input statement re-reads positions 1 and 8; the third and fourth column of the infile are therefore never read.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2018 07:46:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-answer-is-this/m-p/424277#M104463</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-01-02T07:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: Why answer is this?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-answer-is-this/m-p/424344#M104492</link>
      <description>&lt;P&gt;@Look at the INPUT statement. You are using both&amp;nbsp;@ to denote the position of where to start reading and a trailing&amp;nbsp;@.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/141062"&gt;@the&lt;/a&gt; trailing&amp;nbsp;@ keeps the pointer at the line for that data step iteration. At the next data step iteration it moves on. Check the behaviour by running the code with and without the trailing&amp;nbsp;@.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; input &lt;FONT size="5" color="#FF0000"&gt;&lt;STRONG&gt;@1&lt;/STRONG&gt;&lt;/FONT&gt; Var1 $ &lt;FONT size="5" color="#FF0000"&gt;&lt;STRONG&gt;@8&lt;/STRONG&gt; &lt;/FONT&gt;@Var2 $ @; &amp;lt;- reads var1 starting from position1, var2 from position 8 and holds the line.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; input &lt;FONT size="5"&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;@1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt; Var3 $ &lt;FONT size="5"&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;@8&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;@ Var4 $ @;&lt;SPAN&gt;&amp;nbsp;&amp;lt;- reads var3&amp;nbsp;starting from position1, var4 from position 8&amp;nbsp; and holds the line. The run allows it to move to a new line.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/184451"&gt;@mohitraj4u&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&lt;STRONG&gt;Given the text file COLORS.TXT:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;----+----1----+----2----+----&lt;/P&gt;
&lt;DIV class="rtejustify"&gt;RED&amp;nbsp; &amp;nbsp; ORANGE&amp;nbsp; YELLOW&amp;nbsp; GREEN&lt;/DIV&gt;
&lt;DIV class="rtejustify"&gt;BLUE&amp;nbsp; &amp;nbsp;INDIGO&amp;nbsp; &amp;nbsp; PURPLE&amp;nbsp; &amp;nbsp;VIOLET&lt;/DIV&gt;
&lt;DIV class="rtejustify"&gt;CYAN&amp;nbsp; &amp;nbsp;WHITE&amp;nbsp; &amp;nbsp; &amp;nbsp;FUCSIA&amp;nbsp; &amp;nbsp; BLACK&lt;/DIV&gt;
&lt;DIV class="rtejustify"&gt;GRAY&amp;nbsp; &amp;nbsp;BROWN&amp;nbsp; &amp;nbsp;PINK&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MAGENTA&lt;/DIV&gt;
&lt;P&gt;&lt;STRONG&gt;The following SAS program is submitted:&lt;/STRONG&gt;&lt;/P&gt;
&lt;DIV&gt;data WORK.COLORS;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;infile 'COLORS.TXT';&lt;/DIV&gt;
&lt;DIV&gt;@&amp;nbsp; &amp;nbsp; input @1 Var1 $ @8 Var2 $ @;&lt;/DIV&gt;
&lt;DIV&gt;@&amp;nbsp; &amp;nbsp; input @1 Var3 $ @8 Var4 $ @;&lt;BR /&gt;run;&lt;/DIV&gt;
&lt;P&gt;&lt;STRONG&gt;What will the data set WORK.COLORS contain?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Answer:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;Var1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Var2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Var3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Var4&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;------&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ------&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ------&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;------&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;RED&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ORANGE&amp;nbsp; &amp;nbsp; &amp;nbsp; RED&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ORANGE&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;BLUE&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; INDIGO&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; BLUE&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;INDIGO&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CYAN&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WHITE&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CYAN&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;WHITE&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;GRAY&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; BROWN&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;GRAY&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;BROWN&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 02 Jan 2018 15:58:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-answer-is-this/m-p/424344#M104492</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-02T15:58:39Z</dc:date>
    </item>
  </channel>
</rss>

