<?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: Create table name from passed variable in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-table-name-from-passed-variable/m-p/68408#M6814</link>
    <description>Constructing macro variables is not like a DATA step approach - no concatenation (vertical bars) and no quote-marks.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search argument, this topic / post:&lt;BR /&gt;
&lt;BR /&gt;
using macro variables site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
SAS DOC reference:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a002047074.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a002047074.htm&lt;/A&gt;</description>
    <pubDate>Mon, 30 Aug 2010 14:37:30 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2010-08-30T14:37:30Z</dc:date>
    <item>
      <title>Create table name from passed variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-table-name-from-passed-variable/m-p/68406#M6812</link>
      <description>Hi all,&lt;BR /&gt;
&lt;BR /&gt;
i'm still very new with SAS EG and SAS Macro.&lt;BR /&gt;
At first i thought it was gonna be no problem to learn it, since i've got some experience in programming and databases.&lt;BR /&gt;
But surely i was totally wrong! &lt;BR /&gt;
Hopefully can learn a lot from more seasoned users here&lt;BR /&gt;
&lt;BR /&gt;
I created some code as below:&lt;BR /&gt;
&lt;BR /&gt;
/*---BEGIN CODE--- */&lt;BR /&gt;
%MACRO CRT_TBL_GRW(officeID); &lt;BR /&gt;
%LET TABLE_NAME='WORK._' || %put(&amp;amp;officeID);&lt;BR /&gt;
%PUT &amp;amp;TABLE_NAME; &lt;BR /&gt;
&lt;BR /&gt;
PROC SQL OUTOBS=5;&lt;BR /&gt;
 CREATE TABLE &amp;amp;TABLE_NAME AS SELECT DISTINCT TOP5GROWTH_OF_OS_CA_INC.AccountId FORMAT=$20.,&lt;BR /&gt;
	 TOP5GROWTH_OF_OS_CA_INC.AccountName FORMAT=$20.,&lt;BR /&gt;
	 TOP5GROWTH_OF_OS_CA_INC.CustomerId FORMAT=$20.,&lt;BR /&gt;
	 TOP5GROWTH_OF_OS_CA_INC.ProductCategory FORMAT=$50.,&lt;BR /&gt;
	 TOP5GROWTH_OF_OS_CA_INC.FunctionalGroup FORMAT=$40.,&lt;BR /&gt;
	 TOP5GROWTH_OF_OS_CA_INC.OfficeId FORMAT=11.,&lt;BR /&gt;
	 TOP5GROWTH_OF_OS_CA_INC.CurrentBalance_IDR FORMAT=COMMA17.1,&lt;BR /&gt;
	 TOP5GROWTH_OF_OS_CA_INC.Calculation1 &lt;BR /&gt;
 FROM WORK.TOP5GROWTH_OF_OS_CA_INC AS TOP5GROWTH_OF_OS_CA_INC&lt;BR /&gt;
 WHERE TOP5GROWTH_OF_OS_CA_INC.ProductCategory = "GIRO" AND TOP5GROWTH_OF_OS_CA_INC.OfficeId = &amp;amp;officeID &lt;BR /&gt;
 GROUP BY TOP5GROWTH_OF_OS_CA_INC.OfficeId&lt;BR /&gt;
 ORDER BY TOP5GROWTH_OF_OS_CA_INC.OfficeId, TOP5GROWTH_OF_OS_CA_INC.Calculation1 DESCENDING;&lt;BR /&gt;
QUIT;&lt;BR /&gt;
&lt;BR /&gt;
%MEND;&lt;BR /&gt;
&lt;BR /&gt;
%CRT_TBL_GRW(2384);&lt;BR /&gt;
%CRT_TBL_GRW(2023);&lt;BR /&gt;
&lt;BR /&gt;
/* ---END CODE---*/&lt;BR /&gt;
&lt;BR /&gt;
I want to pass parameter through variable and create several tables, but i couldn't manage to run this code properly.&lt;BR /&gt;
&lt;BR /&gt;
The log says:&lt;BR /&gt;
NOTE: Line generated by the macro variable "TABLE_NAME".&lt;BR /&gt;
44          'WORK._' ||&lt;BR /&gt;
                     __&lt;BR /&gt;
                     22&lt;BR /&gt;
ERROR 202-322: The option or parameter is not recognized and will be ignored.&lt;BR /&gt;
&lt;BR /&gt;
ERROR 22-322: Syntax error, expecting one of the following: (, AS, LIKE.  &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Please help, i need some enlightment&lt;BR /&gt;
&lt;BR /&gt;
thank you&lt;BR /&gt;
&lt;BR /&gt;
Best Regards,&lt;BR /&gt;
M. Djojo</description>
      <pubDate>Mon, 30 Aug 2010 12:37:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-table-name-from-passed-variable/m-p/68406#M6812</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-08-30T12:37:13Z</dc:date>
    </item>
    <item>
      <title>Re: Create table name from passed variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-table-name-from-passed-variable/m-p/68407#M6813</link>
      <description>You shouldn't need to use the &lt;B&gt;%put()&lt;/B&gt; function around the &lt;B&gt;&amp;amp;officeID&lt;/B&gt; macro variable.&lt;BR /&gt;
Try it without it. If there's still an issue you could use the &lt;B&gt;%sysfunc(left(&amp;amp;officeId))&lt;/B&gt; function to left align the office id.&lt;BR /&gt;
&lt;BR /&gt;
Hope that helps...</description>
      <pubDate>Mon, 30 Aug 2010 14:25:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-table-name-from-passed-variable/m-p/68407#M6813</guid>
      <dc:creator>Adrian_Mc</dc:creator>
      <dc:date>2010-08-30T14:25:38Z</dc:date>
    </item>
    <item>
      <title>Re: Create table name from passed variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-table-name-from-passed-variable/m-p/68408#M6814</link>
      <description>Constructing macro variables is not like a DATA step approach - no concatenation (vertical bars) and no quote-marks.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search argument, this topic / post:&lt;BR /&gt;
&lt;BR /&gt;
using macro variables site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
SAS DOC reference:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a002047074.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a002047074.htm&lt;/A&gt;</description>
      <pubDate>Mon, 30 Aug 2010 14:37:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-table-name-from-passed-variable/m-p/68408#M6814</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-08-30T14:37:30Z</dc:date>
    </item>
    <item>
      <title>Re: Create table name from passed variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-table-name-from-passed-variable/m-p/68409#M6815</link>
      <description>Hi:&lt;BR /&gt;
  As other folks have explained, macro programming and macro variable concatenation is NOT like DATA step programming or DATA step variable concatenation. This is a good introduction to the concepts of macro variable referencing and writing SAS Macro programs.&lt;BR /&gt;
 &lt;A href="http://www2.sas.com/proceedings/sugi28/056-28.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi28/056-28.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
      <pubDate>Mon, 30 Aug 2010 16:03:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-table-name-from-passed-variable/m-p/68409#M6815</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-08-30T16:03:10Z</dc:date>
    </item>
    <item>
      <title>Re: Create table name from passed variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-table-name-from-passed-variable/m-p/68410#M6816</link>
      <description>Hi all,&lt;BR /&gt;
&lt;BR /&gt;
The macro runs perfectly now, many thanks for your feedbacks.&lt;BR /&gt;
I will definitely take a while before getting familiar with SAS codes.&lt;BR /&gt;
&lt;BR /&gt;
Thank you&lt;BR /&gt;
&lt;BR /&gt;
Best Regards,&lt;BR /&gt;
M. Djojo</description>
      <pubDate>Tue, 31 Aug 2010 05:24:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-table-name-from-passed-variable/m-p/68410#M6816</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-08-31T05:24:46Z</dc:date>
    </item>
  </channel>
</rss>

