<?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: Put statement in data step can not put a date constant properly? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Put-statement-in-data-step-can-not-put-a-date-constant-properly/m-p/562131#M157448</link>
    <description>&lt;P&gt;It seems like it is because SAS don't want to be confused or that it actually get confused.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Avoiding a Common Error When Writing Both a Character Constant and a Variable&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;When using a PUT statement to write a character constant that is followed by a variable name, always put a blank space between the closing quotation mark and the variable name:&lt;/P&gt;&lt;DIV class="topicContent"&gt;&lt;DIV class="paragraph"&gt;&lt;PRE class="codeFragment"&gt;put 'Player:' name1 'Player:' name2 'Player:' name3;&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV class="paragraph"&gt;Otherwise, SAS might interpret a character constant that is followed by a variable name as a special SAS constant as illustrated in this table.&lt;/DIV&gt;&lt;DIV class="paragraph"&gt;Characters That Cause Misinterpretation When They Follow a Character Constant&lt;/DIV&gt;&lt;DIV class="table"&gt;Starting Letter of Variable Represents Examples &lt;TABLE cellspacing="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;b&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;bit testing constant&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;'00100000'b&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;d&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;date constant&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;'01jan04'd&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;dt&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;datetime constant&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;'18jan2003:9:27:05am'dt&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;n&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;name literal&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;'My Table'n&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;t&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;time constant&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;'9:25:19pm't&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;x&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;hexadecimal notation&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;'534153'x&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lestmtsref/63323/HTML/default/viewer.htm#n1spe7nmkmi7ywn175002rof97fv.htm" target="_self"&gt;http://support.sas.com/documentation/cdl/en/lestmtsref/63323/HTML/default/viewer.htm#n1spe7nmkmi7ywn175002rof97fv.htm&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 29 May 2019 00:46:16 GMT</pubDate>
    <dc:creator>heffo</dc:creator>
    <dc:date>2019-05-29T00:46:16Z</dc:date>
    <item>
      <title>Put statement in data step can not put a date constant properly?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-statement-in-data-step-can-not-put-a-date-constant-properly/m-p/562129#M157446</link>
      <description>&lt;P&gt;when I run the following code,I get an error message&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;put '01JAN2019'd ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;The data step codes in the following run smoothly without error.&lt;/P&gt;&lt;P&gt;data test ;&lt;/P&gt;&lt;P&gt;x= '01JAN2019'd ;&lt;/P&gt;&lt;P&gt;put x;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;Why put statement can not work properly in the first data step? since the data constant '01JAN2019'd is&amp;nbsp; valid.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 00:19:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-statement-in-data-step-can-not-put-a-date-constant-properly/m-p/562129#M157446</guid>
      <dc:creator>Steve1964</dc:creator>
      <dc:date>2019-05-29T00:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: Put statement in data step can not put a date constant properly?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-statement-in-data-step-can-not-put-a-date-constant-properly/m-p/562131#M157448</link>
      <description>&lt;P&gt;It seems like it is because SAS don't want to be confused or that it actually get confused.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Avoiding a Common Error When Writing Both a Character Constant and a Variable&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;When using a PUT statement to write a character constant that is followed by a variable name, always put a blank space between the closing quotation mark and the variable name:&lt;/P&gt;&lt;DIV class="topicContent"&gt;&lt;DIV class="paragraph"&gt;&lt;PRE class="codeFragment"&gt;put 'Player:' name1 'Player:' name2 'Player:' name3;&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV class="paragraph"&gt;Otherwise, SAS might interpret a character constant that is followed by a variable name as a special SAS constant as illustrated in this table.&lt;/DIV&gt;&lt;DIV class="paragraph"&gt;Characters That Cause Misinterpretation When They Follow a Character Constant&lt;/DIV&gt;&lt;DIV class="table"&gt;Starting Letter of Variable Represents Examples &lt;TABLE cellspacing="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;b&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;bit testing constant&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;'00100000'b&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;d&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;date constant&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;'01jan04'd&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;dt&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;datetime constant&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;'18jan2003:9:27:05am'dt&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;n&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;name literal&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;'My Table'n&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;t&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;time constant&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;'9:25:19pm't&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;x&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;hexadecimal notation&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class="paraTableFirst"&gt;'534153'x&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lestmtsref/63323/HTML/default/viewer.htm#n1spe7nmkmi7ywn175002rof97fv.htm" target="_self"&gt;http://support.sas.com/documentation/cdl/en/lestmtsref/63323/HTML/default/viewer.htm#n1spe7nmkmi7ywn175002rof97fv.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 00:46:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-statement-in-data-step-can-not-put-a-date-constant-properly/m-p/562131#M157448</guid>
      <dc:creator>heffo</dc:creator>
      <dc:date>2019-05-29T00:46:16Z</dc:date>
    </item>
    <item>
      <title>Re: Put statement in data step can not put a date constant properly?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-statement-in-data-step-can-not-put-a-date-constant-properly/m-p/562150#M157456</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&amp;gt; Why put statement can not work properly in the first data step?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;For the same reason that&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
&amp;nbsp; put 1 ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;does not work.&lt;/P&gt;
&lt;P&gt;The PUT statement accepts a long list of arguments, but not a number.&lt;/P&gt;
&lt;P&gt;See the documentation linked to in the previous reply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 03:34:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-statement-in-data-step-can-not-put-a-date-constant-properly/m-p/562150#M157456</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-05-29T03:34:09Z</dc:date>
    </item>
    <item>
      <title>Re: Put statement in data step can not put a date constant properly?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-statement-in-data-step-can-not-put-a-date-constant-properly/m-p/562165#M157460</link>
      <description>&lt;P&gt;When encountered in the code during compilation, the date constant is imnediately converted to its real value (a number). Since numbers in put statements have special meaning with regards to positions, this then causes your ERROR.&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 05:45:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-statement-in-data-step-can-not-put-a-date-constant-properly/m-p/562165#M157460</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-05-29T05:45:23Z</dc:date>
    </item>
  </channel>
</rss>

