<?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: Using %qsubstr in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-qsubstr/m-p/378676#M91065</link>
    <description>&lt;P&gt;Use %substr rather than %qsubstr as qsubstr is masking some part of the string which is causing the issue later on. &amp;nbsp;Can't think off the top of my head why as I never ever get into a situation where using these types of constucts is necessary, i.e. its never a good idea to put data into dataset names (those things used for programming).&lt;/P&gt;
&lt;PRE&gt;options SYMBOLGEN;
%let yr=2017;
%let shyr=%substr(&amp;amp;yr,3,2);
%put &amp;amp;shyr;
data eocep_spr&amp;amp;shyr._raw;;
set sashelp.class;
run;&lt;/PRE&gt;</description>
    <pubDate>Mon, 24 Jul 2017 13:11:15 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-07-24T13:11:15Z</dc:date>
    <item>
      <title>Using %qsubstr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-qsubstr/m-p/378666#M91059</link>
      <description>&lt;P&gt;SAS appears to resolve the macro variable &amp;amp;shyr. The error occurs in the DATA step when I attempt to create a permanent data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;My code:&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;options SYMBOLGEN;&lt;BR /&gt;%let yr=2017;&lt;BR /&gt;%let shyr=%qsubstr(&amp;amp;yr,3,2);&lt;BR /&gt;%put &amp;amp;shyr;&lt;/P&gt;
&lt;P&gt;***** LIBNAME *****;&lt;BR /&gt;libname eocep "G:\Departments\Research\test scores\EndOfCourse\&amp;amp;yr.";&lt;/P&gt;
&lt;P&gt;data one;&lt;/P&gt;
&lt;P&gt;..&lt;/P&gt;
&lt;P&gt;run; /*the data step is error-free*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;*CREATE RAW PERM DATA SET*;&lt;BR /&gt;data eocep.eocep_spr&amp;amp;shyr._raw;&lt;BR /&gt;set one;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;LOG:&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;177 *CREATE RAW PERM DATA SET*;&lt;BR /&gt;SYMBOLGEN: Macro variable SHYR resolves to 17&lt;BR /&gt;SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing.&lt;BR /&gt;178 data eocep.eocep_spr&amp;amp;shyr._raw;&lt;BR /&gt;NOTE: Line generated by the macro variable "SHYR".&lt;BR /&gt;1 eocep.eocep_spr17_raw&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;--&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 22&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; --&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;200&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: a name,&lt;BR /&gt; a quoted string, (, /, ;, _DATA_, _LAST_, _NULL_.&lt;/P&gt;
&lt;P&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/P&gt;
&lt;P&gt;179 set one;&lt;BR /&gt;180 run;&lt;/P&gt;
&lt;P&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;WARNING: The data set EOCEP.EOCEP_SPR may be incomplete. When this step&lt;BR /&gt; was stopped there were 0 observations and 142 variables.&lt;BR /&gt;WARNING: Data set EOCEP.EOCEP_SPR was not replaced because this step was&lt;BR /&gt; stopped.&lt;BR /&gt;WARNING: The data set WORK._RAW may be incomplete. When this step was&lt;BR /&gt; stopped there were 0 observations and 142 variables.&lt;BR /&gt;WARNING: Data set WORK._RAW was not replaced because this step was stopped.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt; real time 0.09 seconds&lt;BR /&gt; cpu time 0.01 seconds&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 12:51:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-qsubstr/m-p/378666#M91059</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2017-07-24T12:51:58Z</dc:date>
    </item>
    <item>
      <title>Re: Using %qsubstr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-qsubstr/m-p/378676#M91065</link>
      <description>&lt;P&gt;Use %substr rather than %qsubstr as qsubstr is masking some part of the string which is causing the issue later on. &amp;nbsp;Can't think off the top of my head why as I never ever get into a situation where using these types of constucts is necessary, i.e. its never a good idea to put data into dataset names (those things used for programming).&lt;/P&gt;
&lt;PRE&gt;options SYMBOLGEN;
%let yr=2017;
%let shyr=%substr(&amp;amp;yr,3,2);
%put &amp;amp;shyr;
data eocep_spr&amp;amp;shyr._raw;;
set sashelp.class;
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Jul 2017 13:11:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-qsubstr/m-p/378676#M91065</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-07-24T13:11:15Z</dc:date>
    </item>
    <item>
      <title>Re: Using %qsubstr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-qsubstr/m-p/378679#M91067</link>
      <description>&lt;P&gt;%qsubstr adds an internal token that informs the macro engine that macro triggers must not be resolved. That invisible token causes your problems.&lt;/P&gt;
&lt;P&gt;Use %substr instead.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 13:17:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-qsubstr/m-p/378679#M91067</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-07-24T13:17:54Z</dc:date>
    </item>
  </channel>
</rss>

