<?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: Creating a new variable in a datalines step in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-in-a-datalines-step/m-p/558370#M155841</link>
    <description>&lt;P&gt;You cannot calculate a new variable after the data step has already been compiled and run.&lt;/P&gt;
&lt;P&gt;What is confusing you is the spurious RUN: statement in your first example.&amp;nbsp; That is NOT part of the data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another reason to not add that spurious RUN; statement after the end of a data step that is reading in-line data when posting example code. Besides wasting a line in your program file It will confuse novice programmers.&lt;/P&gt;</description>
    <pubDate>Mon, 13 May 2019 16:38:54 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-05-13T16:38:54Z</dc:date>
    <item>
      <title>Creating a new variable in a datalines step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-in-a-datalines-step/m-p/558364#M155839</link>
      <description>&lt;P&gt;This works :&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data xy;
input a  b ;
z=a/b;
datalines ;
123 123
123 456
123 234
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;but this does not :&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data xy;
input a  b ;
datalines ;
123 123
123 456
123 234
;
z=a/b;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Can someone tell me why ? What's going on in the back-end ?&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2019 16:29:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-in-a-datalines-step/m-p/558364#M155839</guid>
      <dc:creator>aditya10</dc:creator>
      <dc:date>2019-05-13T16:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new variable in a datalines step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-in-a-datalines-step/m-p/558366#M155840</link>
      <description>The last semicolon after a datalines/cards statement indicates the end of the data step (you don't need the RUN) and since the data step is terminated, the calculation doesn't make sense because you're now in 'open code' with no data reference. This behaviour is noted in the documentation.</description>
      <pubDate>Mon, 13 May 2019 16:34:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-in-a-datalines-step/m-p/558366#M155840</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-05-13T16:34:16Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new variable in a datalines step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-in-a-datalines-step/m-p/558370#M155841</link>
      <description>&lt;P&gt;You cannot calculate a new variable after the data step has already been compiled and run.&lt;/P&gt;
&lt;P&gt;What is confusing you is the spurious RUN: statement in your first example.&amp;nbsp; That is NOT part of the data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another reason to not add that spurious RUN; statement after the end of a data step that is reading in-line data when posting example code. Besides wasting a line in your program file It will confuse novice programmers.&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2019 16:38:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-in-a-datalines-step/m-p/558370#M155841</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-05-13T16:38:54Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new variable in a datalines step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-in-a-datalines-step/m-p/558594#M155913</link>
      <description>&lt;P&gt;From the documentation of the &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lestmtsref&amp;amp;docsetTarget=p0114gachtut3nn1and4ap8ke9nf.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;DATALINES Statement&lt;/A&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H3 class="xis-title"&gt;Using the DATALINES Statement&lt;/H3&gt;
&lt;DIV id="n0t00rwu6c0n76n19y2wmqrfzwm8" class="xis-topicContent"&gt;
&lt;DIV id="n1ez5xudra8563n1w0acrscbh5xx" class="xis-paragraph"&gt;The DATALINES statement is the &lt;STRONG&gt;last&lt;/STRONG&gt; statement in the DATA step and immediately precedes the first data line. Use a null statement (a single semicolon) to indicate the end of the input data.&lt;/DIV&gt;
&lt;DIV class="xis-paragraph"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="xis-paragraph"&gt;(emphasis by me)&lt;/DIV&gt;
&lt;DIV class="xis-paragraph"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="xis-paragraph"&gt;That's why Maxim 1 is Maxim &lt;U&gt;&lt;STRONG&gt;ONE&lt;/STRONG&gt;&lt;/U&gt;.&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 14 May 2019 12:22:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-in-a-datalines-step/m-p/558594#M155913</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-05-14T12:22:00Z</dc:date>
    </item>
  </channel>
</rss>

