<?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 Put a single apostrophe in front of macro variable value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Put-a-single-apostrophe-in-front-of-macro-variable-value/m-p/516395#M139464</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I have a user defined macro variable as follows:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; dfinactg='31jul2018'd; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; suivi;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; suivi;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;attrib&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; rundate &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;format&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;ddmmyy10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;rundate=&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%str&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;(&amp;amp;dfinactg); &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;runyear=&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%sysfunc&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;(year(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;"&amp;amp;sysdate9"d&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;I want to reinsert this variable in the output dataset so I can refer to it in an excel file.&lt;BR /&gt;&lt;BR /&gt;The issue is that the value gets interpreted as a date and when I concatenate it with text like this ="Situation: " &amp;amp; 'Raw Data'!$S$2 &amp;amp;" Broker" (where 'Raw Data'!$S$2 refers to a cell containing the value 07/31/2018 it converts this value to a datenumber.&lt;BR /&gt;&lt;BR /&gt;To resolve this issue, I want to put a single apostrophe like this '07/31/2018 so excel is forced to interpret it as a string.&lt;BR /&gt;&lt;BR /&gt;I haven't succeeded to do so in SAS&lt;BR /&gt;&lt;BR /&gt;Best&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Nov 2018 16:36:57 GMT</pubDate>
    <dc:creator>pkopersk</dc:creator>
    <dc:date>2018-11-27T16:36:57Z</dc:date>
    <item>
      <title>Put a single apostrophe in front of macro variable value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-a-single-apostrophe-in-front-of-macro-variable-value/m-p/516395#M139464</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I have a user defined macro variable as follows:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; dfinactg='31jul2018'd; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; suivi;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; suivi;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;attrib&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; rundate &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;format&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;ddmmyy10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;rundate=&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%str&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;(&amp;amp;dfinactg); &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;runyear=&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%sysfunc&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;(year(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;"&amp;amp;sysdate9"d&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;I want to reinsert this variable in the output dataset so I can refer to it in an excel file.&lt;BR /&gt;&lt;BR /&gt;The issue is that the value gets interpreted as a date and when I concatenate it with text like this ="Situation: " &amp;amp; 'Raw Data'!$S$2 &amp;amp;" Broker" (where 'Raw Data'!$S$2 refers to a cell containing the value 07/31/2018 it converts this value to a datenumber.&lt;BR /&gt;&lt;BR /&gt;To resolve this issue, I want to put a single apostrophe like this '07/31/2018 so excel is forced to interpret it as a string.&lt;BR /&gt;&lt;BR /&gt;I haven't succeeded to do so in SAS&lt;BR /&gt;&lt;BR /&gt;Best&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Nov 2018 16:36:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-a-single-apostrophe-in-front-of-macro-variable-value/m-p/516395#M139464</guid>
      <dc:creator>pkopersk</dc:creator>
      <dc:date>2018-11-27T16:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: Put a single apostrophe in front of macro variable value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-a-single-apostrophe-in-front-of-macro-variable-value/m-p/516416#M139469</link>
      <description>Instead, you can use TEXT function within Excel and convert the value to a date. This way you can change the format easily within Excel if needed as well. That would be my suggestion. There are a lot of benefits to having a date formatted as date.</description>
      <pubDate>Tue, 27 Nov 2018 16:59:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-a-single-apostrophe-in-front-of-macro-variable-value/m-p/516416#M139469</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-27T16:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: Put a single apostrophe in front of macro variable value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-a-single-apostrophe-in-front-of-macro-variable-value/m-p/516485#M139494</link>
      <description>&lt;P&gt;I often use date literal expressions as macrovars, but don't include the quotes (whether double or single) in the value assigned to the macrovar.&amp;nbsp; Instead&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; dfinactg=31jul2018;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you can&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; suivi;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&amp;nbsp; set&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; suivi;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&amp;nbsp; attrib&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; rundate &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;format&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;ddmmyy10.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp; rundate="&amp;amp;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;dfinactg"d;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp; runyear=&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%sysfunc&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;(year(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;"&amp;amp;sysdate9"d&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;));&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In other words, construct the user-defined macrovar &lt;EM&gt;&lt;STRONG&gt;dfinactg&lt;/STRONG&gt;&lt;/EM&gt; the same as the system defines variable &lt;EM&gt;&lt;STRONG&gt;sydate9&lt;/STRONG&gt;&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Nov 2018 21:19:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-a-single-apostrophe-in-front-of-macro-variable-value/m-p/516485#M139494</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-11-27T21:19:54Z</dc:date>
    </item>
  </channel>
</rss>

