<?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: @@ in statement INPUT? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/in-statement-INPUT/m-p/722512#M224039</link>
    <description>&lt;P&gt;@@&amp;nbsp; insures that the pointer will not go to the next data line as the data step loop iterates.&lt;/P&gt;
&lt;P&gt;so 1 will be read, then the pointer stays on the same line and 2 is read, etc.&lt;/P&gt;</description>
    <pubDate>Mon, 01 Mar 2021 01:12:41 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2021-03-01T01:12:41Z</dc:date>
    <item>
      <title>@@ in statement INPUT?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/in-statement-INPUT/m-p/722511#M224038</link>
      <description>&lt;P&gt;Hi all SAS users,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Today I am trying&amp;nbsp; to understand the usage of _N_, when looking at the &lt;A href="https://sasnrd.com/sas-automatic-n-variable/#:~:text=According%20to%20the%20SAS%20Data,the%20data%20step%20has%20iterated.&amp;amp;text=This%20means%20that%20the%20data%20step%20iterates%20three%20times." target="_self"&gt;link&lt;/A&gt;&amp;nbsp;, I saw an example that the author used to create the dataset:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input x @@;
datalines;
1 2 3
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I am not familiar with the character"@@" so I did a search, and from &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lestmtsref&amp;amp;docsetTarget=n0oaql83drile0n141pdacojq97s.htm&amp;amp;locale=en#p0w3hkircglkogn1eqp3l9rwetlu" target="_self"&gt;what I search&lt;/A&gt;, I still cannot clarify what does "@@" actually do and how it work, could you please explain it to me and how it works in the above code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Warmest regards.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Mar 2021 01:02:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/in-statement-INPUT/m-p/722511#M224038</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-03-01T01:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: @@ in statement INPUT?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/in-statement-INPUT/m-p/722512#M224039</link>
      <description>&lt;P&gt;@@&amp;nbsp; insures that the pointer will not go to the next data line as the data step loop iterates.&lt;/P&gt;
&lt;P&gt;so 1 will be read, then the pointer stays on the same line and 2 is read, etc.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Mar 2021 01:12:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/in-statement-INPUT/m-p/722512#M224039</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-03-01T01:12:41Z</dc:date>
    </item>
    <item>
      <title>Re: @@ in statement INPUT?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/in-statement-INPUT/m-p/722513#M224040</link>
      <description>&lt;P&gt;The &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lestmtsref&amp;amp;docsetTarget=n0lrz3gb7m9e4rn137op544ddg0v.htm&amp;amp;locale=en#n1ao8sok5b1xd9n16qcog81lapey" target="_self"&gt;documentation&lt;/A&gt; describes it.&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;H4 class="xisDoc-argument"&gt;@@&lt;/H4&gt;
&lt;DIV class="xisDoc-argumentDescription"&gt;
&lt;P class="xisDoc-paraSimpleFirst"&gt;holds an input record for the execution of the next INPUT statement across iterations of the DATA step. This line-hold specifier is called&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM class="xisDoc-userSuppliedValue"&gt;double trailing @&lt;/EM&gt;.&lt;/P&gt;
&lt;SECTION class="xisDoc-tableWrap"&gt;
&lt;TABLE class="xisDoc-summary"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="xisDoc-restriction" width="68.8px" height="29px"&gt;Restriction&lt;/TH&gt;
&lt;TD width="670.4px" height="29px" class="xisDoc-summaryText"&gt;The double trailing @ must be the last item in the INPUT statement.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="xisDoc-summaryTip" width="68.8px" height="29px"&gt;Tip&lt;/TH&gt;
&lt;TD width="670.4px" height="29px" class="xisDoc-summaryText"&gt;The double trailing @ is useful when each input line contains values for several observations.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="xisDoc-summarySee" width="68.8px" height="29px"&gt;See&lt;/TH&gt;
&lt;TD width="670.4px" height="29px" class="xisDoc-summaryText"&gt;&lt;A tabindex="0" title="" href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lestmtsref&amp;amp;docsetTarget=n0oaql83drile0n141pdacojq97s.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#p0w3hkircglkogn1eqp3l9rwetlu" data-docset-id="lestmtsref" data-docset-version="9.4" data-original-href="n0oaql83drile0n141pdacojq97s.htm#p0w3hkircglkogn1eqp3l9rwetlu"&gt;Using Line-Hold Specifiers&lt;/A&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/SECTION&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Try experimenting and see what you can figure out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input x @@;
  put _n_= x= ;
datalines;
1 2 3
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;See what happens if you use the COLUMN= option on the INFILE statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile datalines column=cc ;
  put _n_= cc= ;
  input x @@;
  put _n_= cc= x= ;
datalines;
1 2 3
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Mar 2021 01:16:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/in-statement-INPUT/m-p/722513#M224040</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-01T01:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: @@ in statement INPUT?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/in-statement-INPUT/m-p/722514#M224041</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp; and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your explanation, now I can imagine how it works generally. Generally speaking, it jumps to read the number on column 1, 3, 5&amp;nbsp; on the same line (associated with value 1,2,3) after each iteration, and there are three iterations in total.&lt;/P&gt;
&lt;P&gt;Just some curiosity about the example of&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;:&lt;/P&gt;
&lt;P&gt;From&amp;nbsp;&lt;A href="https://www.lexjansen.com/nesug/nesug03/bt/bt003.pdf" target="_self"&gt;what I searched&lt;/A&gt;, "COLUMN Input specifies the columns to be read for each variable". Regarding the first iteration for the code given&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile datalines column=cc ;
  put _n_= cc= ;
  input x @@;
  put _n_= cc= x= ;
datalines;
1 2 3
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The log is&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;_N_=1 cc=1
_N_=1 cc=3 x=1
_N_=2 cc=3
_N_=2 cc=5 x=2
_N_=3 cc=5
_N_=3 cc=7 x=3
_N_=4 cc=7
NOTE: SAS went to a new line when INPUT statement reached past the end of a line.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I am wondering why when cc=3, x should equal to 1 because column 3 of the data lines is "2", not "1". Or cc is the pointer position after the first iteration being executed ?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please explain to me if I fell into any fallacy?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Warm regards.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Mar 2021 01:41:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/in-statement-INPUT/m-p/722514#M224041</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-03-01T01:41:57Z</dc:date>
    </item>
    <item>
      <title>Re: @@ in statement INPUT?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/in-statement-INPUT/m-p/722534#M224056</link>
      <description>&lt;P&gt;Work it out.&amp;nbsp; Change the line(s) of data and see what happens.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;P&gt;On the first iteration the pointer starts in column 1.&amp;nbsp; Then after reading the first value the point moves to after the value. Since the first value is one character the pointer moves one column to read that and then another column to read the delimiter so it end at column 3.&amp;nbsp; Since you used double&amp;nbsp;@ on the second iteration the pointer starts at three.&amp;nbsp; ....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On the fourth iteration the pointer starts in column 7, which is past the last non-blank character in the line.&amp;nbsp; So it flows over to the next line to find a value to read.&amp;nbsp; But since there is no next line the data step ends right there.&lt;/P&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Mar 2021 06:25:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/in-statement-INPUT/m-p/722534#M224056</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-01T06:25:47Z</dc:date>
    </item>
    <item>
      <title>Re: @@ in statement INPUT?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/in-statement-INPUT/m-p/722556#M224067</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212695"&gt;@Phil_NZ&lt;/a&gt;,&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212695"&gt;@Phil_NZ&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;From&amp;nbsp;&lt;A href="https://www.lexjansen.com/nesug/nesug03/bt/bt003.pdf" target="_self"&gt;what I searched&lt;/A&gt;, "COLUMN Input specifies the columns to be read for each variable".&lt;/P&gt;
&lt;P&gt;(...)&lt;/P&gt;
&lt;P&gt;Could you please explain to me if I fell into any fallacy?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It appears that you misinterpreted the &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lestmtsref&amp;amp;docsetTarget=n1rill4udj0tfun1fvce3j401plo.htm&amp;amp;locale=en#n14rjz20kqjrgpn1jpffa0x4i9kl" target="_blank" rel="noopener"&gt;COLUMN= option&lt;/A&gt; of the INFILE statement as an indication of &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lestmtsref&amp;amp;docsetTarget=n13ejk9swz5vrbn0z34iazfrp0wp.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;&lt;EM&gt;column input&lt;/EM&gt;&lt;/A&gt;. However, your INPUT statement performs &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lestmtsref&amp;amp;docsetTarget=n0lrz3gb7m9e4rn137op544ddg0v.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;&lt;EM&gt;list&lt;/EM&gt; input&lt;/A&gt;, not column input. The COLUMN= option can be used with all four input styles. For example, it can help you to see one of the differences between list input and column input (in fact between list input and the three other input styles): The position of the input pointer after reading a value.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
infile cards column=c;
input x 1; /* Column input (1 is the column number). Without the "1" it would  */
put x= c=; /* be list input. Note how x and c differ between the two versions. */
cards;
85
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 01 Mar 2021 11:23:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/in-statement-INPUT/m-p/722556#M224067</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-03-01T11:23:37Z</dc:date>
    </item>
  </channel>
</rss>

