<?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: MACRO QUOTING in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/MACRO-QUOTING/m-p/597644#M172228</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/84674"&gt;@jins&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you found one of the answers to be&amp;nbsp;the solution for you then please mark it as solution so we know you've got your answer. Marking something as solution will also help others who search the forums later on to get answers to similar problems.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Fri, 18 Oct 2019 08:18:22 GMT</pubDate>
    <dc:creator>ed_sas_member</dc:creator>
    <dc:date>2019-10-18T08:18:22Z</dc:date>
    <item>
      <title>MACRO QUOTING</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MACRO-QUOTING/m-p/596802#M171891</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying a scenario where a data set with variable names can accept all these special characters and these variables pass through macro variable for further processing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;~ ` ! @ # $ % ^ &amp;amp; ( ) _ + = { } [ ] ; ' ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, i created this exhaustive list of all special characters separated by letter 'u'. Is this possible at all?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, i am using the VALIDVARNAME=ANY options in SAS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let subject=u~u`u!u@u#u$u%u^u&amp;amp;u(u)u_u+u=u{u}u[u]u;u'u,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;proc sort data=data1 out=data2 nodupkey;&lt;BR /&gt;by &amp;amp;subject;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2019 10:32:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MACRO-QUOTING/m-p/596802#M171891</guid>
      <dc:creator>jins</dc:creator>
      <dc:date>2019-10-16T10:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: MACRO QUOTING</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MACRO-QUOTING/m-p/596808#M171895</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/84674"&gt;@jins&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the function %nrstr() to hide special characters. Don't forget to add a % before characters that generally occur by pairs such as ' or ".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let subject=%nrstr(u~u`u!u@u#u$u%u^u&amp;amp;u(u)u_u+u=u{u}u[u]u;u%'u,);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 16 Oct 2019 10:47:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MACRO-QUOTING/m-p/596808#M171895</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2019-10-16T10:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: MACRO QUOTING</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MACRO-QUOTING/m-p/596823#M171899</link>
      <description>&lt;P&gt;Instead of having to use complicated programming that is hard to maintain and error-prone, get rid of the non-standard variable names as soon as the data is imported into SAS, and keep the original names in labels. LABELS are the place for fancy strings.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2019 11:16:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MACRO-QUOTING/m-p/596823#M171899</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-16T11:16:12Z</dc:date>
    </item>
    <item>
      <title>Re: MACRO QUOTING</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MACRO-QUOTING/m-p/597644#M172228</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/84674"&gt;@jins&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you found one of the answers to be&amp;nbsp;the solution for you then please mark it as solution so we know you've got your answer. Marking something as solution will also help others who search the forums later on to get answers to similar problems.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2019 08:18:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MACRO-QUOTING/m-p/597644#M172228</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2019-10-18T08:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: MACRO QUOTING</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MACRO-QUOTING/m-p/597692#M172236</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to the documentation, with validvarname=any, you are limited to 32 characters anyway&lt;/P&gt;
&lt;P&gt;so your example, for instance, could not work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000279245.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000279245.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When using an unconventional variable name, you have to quote it as 'var name'n or "var name"n.&lt;/P&gt;
&lt;P&gt;Use the latter if you want macrovariables between quotes to be resolved.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example without characters % and &amp;amp; to avoid dealing with unwanted macro resolutions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;option validvarname=ANY;

data have;
input "@u#u$u^u(u)u{u}u[u]u;u'u,"n;
cards;
1
2
3
0
;
run;

data _NULL_;
    call symputx("subject","@u#u$u^u(u)u{u}u[u]u;u'u,");
run;

proc sort data=have out=want; 
    by "&amp;amp;subject."n; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The best solution being following &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;'s advice and rename your variables to standard names as soon as possible.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2019 11:50:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MACRO-QUOTING/m-p/597692#M172236</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2019-10-18T11:50:46Z</dc:date>
    </item>
    <item>
      <title>Re: MACRO QUOTING</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MACRO-QUOTING/m-p/597704#M172238</link>
      <description>&lt;P&gt;Are the strange characters part of the variable NAME or the VALUE?&lt;/P&gt;
&lt;P&gt;For a name you need to use name literals.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let subject= 'a@b'n;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To make it easier use the NLITERAL() function.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;call symputx('subject',nliteral(_name_));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Oct 2019 12:48:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MACRO-QUOTING/m-p/597704#M172238</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-18T12:48:58Z</dc:date>
    </item>
  </channel>
</rss>

