<?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: How do you add single quotes to a macro variable that's a date? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-add-single-quotes-to-a-macro-variable-that-s-a-date/m-p/752421#M237013</link>
    <description>How are you generating that macro variable? That's where you make the change, so is it via SQL, data step?</description>
    <pubDate>Tue, 06 Jul 2021 20:55:17 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2021-07-06T20:55:17Z</dc:date>
    <item>
      <title>How do you add single quotes to a macro variable that's a date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-add-single-quotes-to-a-macro-variable-that-s-a-date/m-p/752415#M237009</link>
      <description>&lt;P&gt;&lt;STRONG&gt;HAVE:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;/* in yyyy-mm-dd format */&lt;/P&gt;&lt;P&gt;/* date1 is a macro variable within the program */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* current value of date1 */&lt;/P&gt;&lt;P&gt;date1 = 2017-04-20&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NEED:&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;date1 = '2017-04-20'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ATTEMPT:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;/* Tried to put double quotes around it then replace it with single quotes, but this didn't work. */&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;set date1;&lt;BR /&gt;date1= quote(date1);&lt;BR /&gt;%put &amp;amp;date1&lt;BR /&gt;date1= %sysfunc (translate (&amp;amp;date1,%str(%"),%str(%')));&lt;BR /&gt;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone tell me the place where I'm going wrong?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jul 2021 20:44:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-add-single-quotes-to-a-macro-variable-that-s-a-date/m-p/752415#M237009</guid>
      <dc:creator>unwanted_banana</dc:creator>
      <dc:date>2021-07-06T20:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: How do you add single quotes to a macro variable that's a date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-add-single-quotes-to-a-macro-variable-that-s-a-date/m-p/752420#M237012</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let date1 = %unquote(%str(%'&amp;amp;date1%'));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jul 2021 20:51:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-add-single-quotes-to-a-macro-variable-that-s-a-date/m-p/752420#M237012</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-07-06T20:51:55Z</dc:date>
    </item>
    <item>
      <title>Re: How do you add single quotes to a macro variable that's a date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-add-single-quotes-to-a-macro-variable-that-s-a-date/m-p/752421#M237013</link>
      <description>How are you generating that macro variable? That's where you make the change, so is it via SQL, data step?</description>
      <pubDate>Tue, 06 Jul 2021 20:55:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-add-single-quotes-to-a-macro-variable-that-s-a-date/m-p/752421#M237013</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-07-06T20:55:17Z</dc:date>
    </item>
    <item>
      <title>Re: How do you add single quotes to a macro variable that's a date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-add-single-quotes-to-a-macro-variable-that-s-a-date/m-p/752424#M237016</link>
      <description>&lt;P&gt;It comes from a refined table (getdates) which only has one data value in its column (date1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;BR /&gt;select date&lt;BR /&gt;into :date1&lt;BR /&gt;from getdates;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jul 2021 21:00:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-add-single-quotes-to-a-macro-variable-that-s-a-date/m-p/752424#M237016</guid>
      <dc:creator>unwanted_banana</dc:creator>
      <dc:date>2021-07-06T21:00:34Z</dc:date>
    </item>
    <item>
      <title>Re: How do you add single quotes to a macro variable that's a date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-add-single-quotes-to-a-macro-variable-that-s-a-date/m-p/752435#M237025</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select quote(date, "'") 
into :date1
from getdates;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Pass it with quotes in the value already then.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/388543"&gt;@unwanted_banana&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;It comes from a refined table (getdates) which only has one data value in its column (date1)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql noprint;&lt;BR /&gt;select date&lt;BR /&gt;into :date1&lt;BR /&gt;from getdates;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jul 2021 21:26:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-add-single-quotes-to-a-macro-variable-that-s-a-date/m-p/752435#M237025</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-07-06T21:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do you add single quotes to a macro variable that's a date?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-you-add-single-quotes-to-a-macro-variable-that-s-a-date/m-p/752538#M237075</link>
      <description>%let date1=2017-04-20 ;&lt;BR /&gt;%let date2 = %bquote('&amp;amp;date1');&lt;BR /&gt;&lt;BR /&gt;%put &amp;amp;date2. ;</description>
      <pubDate>Wed, 07 Jul 2021 12:33:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-you-add-single-quotes-to-a-macro-variable-that-s-a-date/m-p/752538#M237075</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-07-07T12:33:07Z</dc:date>
    </item>
  </channel>
</rss>

