<?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: Error in  table name generation using underscore in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Error-in-table-name-generation-using-underscore/m-p/820282#M323751</link>
    <description>&lt;P&gt;You can sometimes confuse the parser with syntax like that.&amp;nbsp; It generates code without any spaces, but the parser still treats it as multiple tokens instead of one.&amp;nbsp; Normally I see it more often when running the code inside a macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I find the least confusing it to build the name into another macro variable and then use that to generate the code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let dsname=_&amp;amp;var2.&amp;amp;j;

proc freq data=test noprint;
  tables landing_page_url / out=&amp;amp;dsname (drop=count) missing;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can also just add some macro function around it.&amp;nbsp; In this case %UNQUOTE() is a good one.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=test noprint;
  tables landing_page_url / out=%unquote(_&amp;amp;var2.&amp;amp;j)(drop=count) missing;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 24 Jun 2022 16:58:45 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-06-24T16:58:45Z</dc:date>
    <item>
      <title>Error in  table name generation using underscore</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-in-table-name-generation-using-underscore/m-p/820280#M323749</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp; I'm testing the following:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%let var0="dog"n? "cat"n?;

%let var=%scan(&amp;amp;var0,1,?,m);
%put &amp;amp;var;

%let var2=%qtrim(%qscan(&amp;amp;var,1,%str(%")));
%put &amp;amp;var2;

%let j=1;


data test ;
length landing_page_url $300.;
input id landing_page_url $;
datalines;
10 cccc
5  dd
;
run;

proc freq data=test noprint;
tables landing_page_url / out=_&amp;amp;var2.&amp;amp;j (drop=count) missing;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I'm getting a no real explicative error in the proc freq output:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;83    proc freq data=test noprint;
84    tables landing_page_url / out=_&amp;amp;var2.&amp;amp;j (drop=count) missing;
SYMBOLGEN:  Macro variable VAR2 resolves to dog
SYMBOLGEN:  Some characters in the above value which were subject to macro quoting have been unquoted for printing.
SYMBOLGEN:  Macro variable J resolves to 1
NOTE: Line generated by the macro variable "J".
84    _dog1
       ---
       22
        ---
        76
ERROR 22-322: Syntax error, expecting one of the following: ;, (, AGREE, ALL, ALPHA, BDT, BIN, BINOMIAL, CELLCHI2, CHISQ, CL, CMH, 
              CMH1, CMH2, COMMONRISKDIFF, COMONMRDIFF, CONTENTS, CONVERGE, CROSSLIST, CUMCOL, DEVIATION, EXACT, EXPECTED, FISHER, 
              FORMAT, GAILSIMON, GS, JT, KAPPA, LINE, LIST, MAXITER, MAXLEVELS, MEASURES, MISSING, MISSPRINT, NOCOL, NOCUM, NOFREQ, 
              NOPERCENT, NOPRINT, NOROW, NOSPARSE, NOWARN, ODDSRATIO, OR, OUT, OUTCUM, OUTEXPECT, OUTPCT, PEARSONRES, PEARSONRESID, 
              PLCORR, PLOTS, PRINTKWTS, PRINTWTS, RELRISK, RISKDIFF, SCORE, SCORES, SCOROUT, SENSPEC, SPARSE, STDRES, STDRESID, 
              TABLE, TESTF, TESTP, TOTPCT, TREND, WARN.  
ERROR 76-322: Syntax error, statement will be ignored.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;No idea why is not accepting the table name starting with underscore, as according to SAS documentation it should work&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any tips to share?&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 16:50:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-in-table-name-generation-using-underscore/m-p/820280#M323749</guid>
      <dc:creator>dcortell</dc:creator>
      <dc:date>2022-06-24T16:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: Error in  table name generation using underscore</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-in-table-name-generation-using-underscore/m-p/820282#M323751</link>
      <description>&lt;P&gt;You can sometimes confuse the parser with syntax like that.&amp;nbsp; It generates code without any spaces, but the parser still treats it as multiple tokens instead of one.&amp;nbsp; Normally I see it more often when running the code inside a macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I find the least confusing it to build the name into another macro variable and then use that to generate the code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let dsname=_&amp;amp;var2.&amp;amp;j;

proc freq data=test noprint;
  tables landing_page_url / out=&amp;amp;dsname (drop=count) missing;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can also just add some macro function around it.&amp;nbsp; In this case %UNQUOTE() is a good one.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=test noprint;
  tables landing_page_url / out=%unquote(_&amp;amp;var2.&amp;amp;j)(drop=count) missing;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Jun 2022 16:58:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-in-table-name-generation-using-underscore/m-p/820282#M323751</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-06-24T16:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: Error in  table name generation using underscore</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-in-table-name-generation-using-underscore/m-p/820284#M323752</link>
      <description>&lt;P&gt;The following did the job:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%let final=_&amp;amp;var2.&amp;amp;j;

proc freq data=test noprint;
tables landing_page_url / out=%unquote(&amp;amp;final) (drop=count) missing;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Withotu the %unquote applied, the same error still was provided. Thanks Tom&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 17:05:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-in-table-name-generation-using-underscore/m-p/820284#M323752</guid>
      <dc:creator>dcortell</dc:creator>
      <dc:date>2022-06-24T17:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: Error in  table name generation using underscore</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-in-table-name-generation-using-underscore/m-p/820291#M323756</link>
      <description>&lt;P&gt;In that case it is probably the macro quoting you added to the macro variables with the use of %QSCAN() and %QTRIM().&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You shouldn't need those for strings you are going to use to generate a name. None of the characters that are valid in a name need macro quoting.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 17:35:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-in-table-name-generation-using-underscore/m-p/820291#M323756</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-06-24T17:35:13Z</dc:date>
    </item>
  </channel>
</rss>

