<?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 is multiple semicolon used in this INPUT statement? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/why-is-multiple-semicolon-used-in-this-INPUT-statement/m-p/838325#M331452</link>
    <description>&lt;P&gt;It definitely does NOT run the same if you convert three statements into one statement by removing the semicolons that end the first two statements.&lt;/P&gt;
&lt;PRE&gt;686  DATA DATES;
687  INPUT @1 BDATE MMDDYY8.;
688  TARGET=MDY(08,25,2009);
689  * Uses MDY() function;
690  AGE=INTCK('YEAR',BDATE,TARGET); * INTCK function;
691  DATALINES;

NOTE: The data set WORK.DATES has 3 observations and 3 variables.
NOTE: DATA statement used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds


695  ;
696  DATA DATES;
697  INPUT @1 BDATE MMDDYY8.
698  TARGET=MDY(08,25,2009)
                --
                22
                76
ERROR 22-322: Syntax error, expecting one of the following: a name, arrayname, _ALL_, _CHARACTER_, _CHAR_, _NUMERIC_.

ERROR 76-322: Syntax error, statement will be ignored.

699  * Uses MDY() function;
700  AGE=INTCK('YEAR',BDATE,TARGET); * INTCK function;
701  DATALINES;

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.DATES may be incomplete.  When this step was stopped there were 0 observations and 4 variables.
WARNING: Data set WORK.DATES was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds

705  ;

&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 13 Oct 2022 03:02:41 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-10-13T03:02:41Z</dc:date>
    <item>
      <title>why is multiple semicolon used in this INPUT statement?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-is-multiple-semicolon-used-in-this-INPUT-statement/m-p/838319#M331449</link>
      <description>&lt;P&gt;Hi I am reading an example in SAS Essentials by Elliot (pg. 137) screenshot as follow&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 699px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76118i131CBD912D33F892/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;When I run the code without the two semicolons I circled, the result is exact the same as with the two circle semicolons.&lt;/P&gt;&lt;P&gt;the only difference is the there are two syntax error in the log&lt;/P&gt;&lt;P&gt;they are&lt;/P&gt;&lt;P&gt;What is the point of the two semicolon in the INPUT statement if SAS can generate the result them?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought the purpose of the semicolon is to close a statement, when the first semicolon exist, should it immediately terminate the input statement?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, arrayname, _ALL_, _CHARACTER_, _CHAR_, _NUMERIC_. ERROR 76-322: Syntax error, statement will be ignored.&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;here is the code if anyone is interested&lt;/P&gt;&lt;PRE&gt;DATA DATES;
INPUT @1 BDATE MMDDYY8.;
TARGET=MDY(08,25,2009);
* Uses MDY() function;
AGE=INTCK('YEAR',BDATE,TARGET); * INTCK function;
DATALINES;
07101952
07041776
01011900
;
PROC PRINT DATA=DATES;
FORMAT BDATE WEEKDATE. TARGET MMDDYY8.;
RUN;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Oct 2022 01:29:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-is-multiple-semicolon-used-in-this-INPUT-statement/m-p/838319#M331449</guid>
      <dc:creator>Nietzsche</dc:creator>
      <dc:date>2022-10-13T01:29:48Z</dc:date>
    </item>
    <item>
      <title>Re: why is multiple semicolon used in this INPUT statement?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-is-multiple-semicolon-used-in-this-INPUT-statement/m-p/838324#M331451</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1665629856071.png" style="width: 867px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76119iE28719FDF9499835/image-dimensions/867x26?v=v2" width="867" height="26" role="button" title="Patrick_0-1665629856071.png" alt="Patrick_0-1665629856071.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;That's exactly happens. The first semicolon terminates the input statement, the 2nd semicolon terminates code that assigns a value to a variable (this one has nothing to do with the input statement).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_1-1665629997727.png" style="width: 943px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76120i91BBF8594B9E33E0/image-dimensions/943x33?v=v2" width="943" height="33" role="button" title="Patrick_1-1665629997727.png" alt="Patrick_1-1665629997727.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;It can't.&amp;nbsp;If you run your code in a fresh new SAS session without the semicolons then the target table won't get created. What you might see in your test is the "left over" from your first run with correct syntax.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 03:00:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-is-multiple-semicolon-used-in-this-INPUT-statement/m-p/838324#M331451</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-10-13T03:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: why is multiple semicolon used in this INPUT statement?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-is-multiple-semicolon-used-in-this-INPUT-statement/m-p/838325#M331452</link>
      <description>&lt;P&gt;It definitely does NOT run the same if you convert three statements into one statement by removing the semicolons that end the first two statements.&lt;/P&gt;
&lt;PRE&gt;686  DATA DATES;
687  INPUT @1 BDATE MMDDYY8.;
688  TARGET=MDY(08,25,2009);
689  * Uses MDY() function;
690  AGE=INTCK('YEAR',BDATE,TARGET); * INTCK function;
691  DATALINES;

NOTE: The data set WORK.DATES has 3 observations and 3 variables.
NOTE: DATA statement used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds


695  ;
696  DATA DATES;
697  INPUT @1 BDATE MMDDYY8.
698  TARGET=MDY(08,25,2009)
                --
                22
                76
ERROR 22-322: Syntax error, expecting one of the following: a name, arrayname, _ALL_, _CHARACTER_, _CHAR_, _NUMERIC_.

ERROR 76-322: Syntax error, statement will be ignored.

699  * Uses MDY() function;
700  AGE=INTCK('YEAR',BDATE,TARGET); * INTCK function;
701  DATALINES;

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.DATES may be incomplete.  When this step was stopped there were 0 observations and 4 variables.
WARNING: Data set WORK.DATES was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds

705  ;

&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 03:02:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-is-multiple-semicolon-used-in-this-INPUT-statement/m-p/838325#M331452</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-10-13T03:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: why is multiple semicolon used in this INPUT statement?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-is-multiple-semicolon-used-in-this-INPUT-statement/m-p/838329#M331454</link>
      <description>&lt;P&gt;okay I think I fundamentally misunderstood the INPUT statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so if the variables data is not from DATALINES, then you don't need to use INPUT? You can simply define for example a constant variable without using INPUT before PROC MEANS/PRINT?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 03:41:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-is-multiple-semicolon-used-in-this-INPUT-statement/m-p/838329#M331454</guid>
      <dc:creator>Nietzsche</dc:creator>
      <dc:date>2022-10-13T03:41:12Z</dc:date>
    </item>
    <item>
      <title>Re: why is multiple semicolon used in this INPUT statement?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-is-multiple-semicolon-used-in-this-INPUT-statement/m-p/838340#M331457</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/431484"&gt;@Nietzsche&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/n0oaql83drile0n141pdacojq97s.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/n0oaql83drile0n141pdacojq97s.htm&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1665641601892.png" style="width: 714px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76124i2726BF0133C4AE21/image-dimensions/714x68?v=v2" width="714" height="68" role="button" title="Patrick_0-1665641601892.png" alt="Patrick_0-1665641601892.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Basically: The input statement is used to read EXTERNAL data into SAS VARIABLE.&lt;/P&gt;
&lt;P&gt;Normally the INPUT statement is paired with the INFILE statement. The INFILE statement defines the external file (like where it's stored), and the input statement then reads the data.&lt;/P&gt;
&lt;P&gt;DATALINES is for in-stream data (=data directly in the code) and though a bit of special case and normally only used to create some self-contained samples.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;May-be reading below will create a bit more clarity for you.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lepg/p1vahis9wkdkvin17obs1381xenf.htm" target="_self"&gt;Reading Raw Data&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lepg/n1ifxhypm4wdmkn1w5m3qd3rzrp7.htm" target="_self"&gt;Reading External Files&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And don't worry - just the normal confusion of a beginner. You'll get there. It's not that complicated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 06:20:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-is-multiple-semicolon-used-in-this-INPUT-statement/m-p/838340#M331457</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-10-13T06:20:46Z</dc:date>
    </item>
  </channel>
</rss>

