<?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 Text in quotation marks in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Put-Text-in-quotation-marks/m-p/490551#M128360</link>
    <description>&lt;P&gt;When defining your variable "word" , do not use quotes.&amp;nbsp; Quotes aren't needed for a macro variable. It would look like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let word = abcde;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See if that helps solve the isse.&lt;/P&gt;</description>
    <pubDate>Tue, 28 Aug 2018 16:33:54 GMT</pubDate>
    <dc:creator>debw16</dc:creator>
    <dc:date>2018-08-28T16:33:54Z</dc:date>
    <item>
      <title>Put Text in quotation marks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-Text-in-quotation-marks/m-p/490516#M128341</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have the following code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%macro test;

%let word='abcde';

data _null_; 
&amp;nbsp;&amp;nbsp; _notValidSign = substr(&amp;amp;word., 2, 1);
&amp;nbsp;&amp;nbsp; put 'ERROR:&amp;nbsp;&amp;nbsp;&amp;nbsp; ' _notValidSign;
run;

%mend test;

%test;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just want to set quotation marks around the variable _notValidSign.&lt;/P&gt;
&lt;P&gt;So the output looks like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ERROR:    "b"&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I tried e.g.:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;put 'ERROR:    ' ""_notValidSign"";

And i get the output with a blank - why is this?:

ERROR:     "b ";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can someone help please?&lt;/P&gt;
&lt;P&gt;Thank you very much&lt;/P&gt;
&lt;P&gt;Best regards&lt;/P&gt;
&lt;P&gt;George&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 15:50:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-Text-in-quotation-marks/m-p/490516#M128341</guid>
      <dc:creator>sorosch</dc:creator>
      <dc:date>2018-08-28T15:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: Put Text in quotation marks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-Text-in-quotation-marks/m-p/490523#M128344</link>
      <description>&lt;P&gt;First, check your posts to make sure they are legible. Sometimes, depending on how you paste things the box makes the code hard to read.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to quote text, use the correct function: QUOTE.&lt;/P&gt;
&lt;P&gt;Use of the multiple quote marks is likely to introduce issues as you have found.&lt;/P&gt;
&lt;P&gt;Note that the quote function may result with blanks as well depending on what the argument is. If the value returned has a length longer the actual value it will contain trailing blanks. If you want to ensure there are never trailing blanks then use the STRIP function to remove them: quote( strip ( &amp;lt;some character value&amp;gt;))&lt;/P&gt;
&lt;P&gt;The below works as desired because you are explicitly returning exactly one character from the result of the substr function.&lt;/P&gt;
&lt;PRE&gt;%macro test;
%let word='abcde';
data _null_;
_notValidSign = quote(substr(&amp;amp;word., 2, 1));
put 'ERROR:    ' _notValidSign;
run;
%mend test;

%test;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Aug 2018 15:45:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-Text-in-quotation-marks/m-p/490523#M128344</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-08-28T15:45:11Z</dc:date>
    </item>
    <item>
      <title>Re: Put Text in quotation marks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-Text-in-quotation-marks/m-p/490530#M128349</link>
      <description>&lt;P&gt;As usual, when macro language is involved, people tend to out-think themselves:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let word=abcde;

data _null_;
length _notValidSign $1;
_notValidSign = substr("&amp;amp;word.", 2, 1);
out = 'ERROR:    "' !! _notValidSign !! '"';
put out;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Aug 2018 15:53:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-Text-in-quotation-marks/m-p/490530#M128349</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-08-28T15:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: Put Text in quotation marks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-Text-in-quotation-marks/m-p/490531#M128350</link>
      <description>&lt;P&gt;The major factor you are overlooking as that the PUT statement automatically leaves a blank after writing a variable.&amp;nbsp; You can control that:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;put _notValidSIgn $1.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A secondary issue that doesn't come into play here:&amp;nbsp; the length of _notValidSIgn is $5.&amp;nbsp; When SUBSTR creates a new variable, it automatically assigns that variable the same length as the incoming string.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 15:54:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-Text-in-quotation-marks/m-p/490531#M128350</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-08-28T15:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: Put Text in quotation marks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-Text-in-quotation-marks/m-p/490532#M128351</link>
      <description>&lt;P&gt;Do you want the quotes in the value or just in the output?&lt;/P&gt;
&lt;P&gt;If just in the output then use the $QUOTE. format.&amp;nbsp; You might want to add the : modifier to avoid including the trialing spaces inside the quotes.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 15:59:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-Text-in-quotation-marks/m-p/490532#M128351</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-08-28T15:59:43Z</dc:date>
    </item>
    <item>
      <title>Re: Put Text in quotation marks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-Text-in-quotation-marks/m-p/490551#M128360</link>
      <description>&lt;P&gt;When defining your variable "word" , do not use quotes.&amp;nbsp; Quotes aren't needed for a macro variable. It would look like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let word = abcde;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See if that helps solve the isse.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 16:33:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-Text-in-quotation-marks/m-p/490551#M128360</guid>
      <dc:creator>debw16</dc:creator>
      <dc:date>2018-08-28T16:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: Put Text in quotation marks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Put-Text-in-quotation-marks/m-p/490877#M128586</link>
      <description>&lt;P&gt;Thank you very much to you all for your help. S&lt;SPAN class="short_text"&gt;&lt;SPAN class=""&gt;ometimes you are really on the hose....&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="short_text"&gt;&lt;SPAN class=""&gt;So easy...&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="short_text"&gt;&lt;SPAN class=""&gt;Thanks to all&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="short_text"&gt;&lt;SPAN class=""&gt;Best reagrds&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="short_text"&gt;&lt;SPAN class=""&gt;George&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 15:11:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Put-Text-in-quotation-marks/m-p/490877#M128586</guid>
      <dc:creator>sorosch</dc:creator>
      <dc:date>2018-08-29T15:11:46Z</dc:date>
    </item>
  </channel>
</rss>

