<?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 Macro VAriable as Column Name Static Text in PROC SQL in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-Macro-VAriable-as-Column-Name-Static-Text-in-PROC-SQL/m-p/697064#M213002</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp; Sir, yeah i noticed that one too after i posted this, buit fixing that also did not resolve my issue. Still i am getting the same error. To test it out i wrote a small sample program which reproduces the error. If you can help me debug it, that would be great&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Program&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%macro test_macro(var=);
proc sql;
	create table test as 
		select %bquote('&amp;amp;var') as COLUMN1 from sashelp.class
		;
run;
%mend test_macro;

%test_macro(var=ABCD);&lt;/PRE&gt;&lt;P&gt;Output&lt;/P&gt;&lt;PRE&gt;1                                                          The SAS System                    Thursday, November  5, 2020 09:02:00 PM

1          ;*';*";*/;quit;run;
2          OPTIONS PAGENO=MIN;
3          %LET _CLIENTTASKLABEL='Program';
4          %LET _CLIENTPROCESSFLOWNAME='Process Flow';
5          %LET _CLIENTPROJECTPATH='';
6          %LET _CLIENTPROJECTPATHHOST='';
7          %LET _CLIENTPROJECTNAME='';
8          %LET _SASPROGRAMFILE='';
9          %LET _SASPROGRAMFILEHOST='';
10         
11         ODS _ALL_ CLOSE;
12         OPTIONS DEV=PNG;
13         FILENAME EGSR TEMP;
14         ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR
15             STYLE=HTMLBlue
16             STYLESHEET=(URL="file:///C:/Program%20Files/SASHome/SASEnterpriseGuide/7.1/Styles/HTMLBlue.css")
17             NOGTITLE
18             NOGFOOTNOTE
19             GPATH=&amp;amp;sasworklocation
20             ENCODING=UTF8
21             options(rolap="on")
22         ;
NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
23         
24         %macro test_macro(var=);
25         proc sql;
26         	create table test as
27         		select %bquote('&amp;amp;var') as COLUMN1 from sashelp.class
28         		;
29         run;
30         %mend test_macro;
31         
32         %test_macro(var=ABCD);
&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
NOTE: Line generated by the macro function "BQUOTE".
32         'ABCD'
           _
           22
            _
            200
NOTE: PROC SQL statements are executed immediately; The RUN statement has no effect.
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant, 
              a missing value, (, *, +, -, ALL, BTRIM, CALCULATED, CASE, DISTINCT, EXISTS, INPUT, NOT, PUT, SUBSTRING, TRANSLATE, 
              UNIQUE, USER, ^, ~.  

ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/STRONG&gt;&lt;/FONT&gt;

33         
34         %LET _CLIENTTASKLABEL=;
35         %LET _CLIENTPROCESSFLOWNAME=;
36         %LET _CLIENTPROJECTPATH=;
37         %LET _CLIENTPROJECTPATHHOST=;
38         %LET _CLIENTPROJECTNAME=;
39         %LET _SASPROGRAMFILE=;
40         %LET _SASPROGRAMFILEHOST=;
41         
42         ;*';*";*/;quit;
NOTE: The SAS System stopped processing this step because of errors.
2                                                          The SAS System                    Thursday, November  5, 2020 09:02:00 PM

NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      
42       !                run;
43         ODS _ALL_ CLOSE;
44         
45         
46         QUIT; RUN;
47         &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 06 Nov 2020 06:53:11 GMT</pubDate>
    <dc:creator>rajesh1980</dc:creator>
    <dc:date>2020-11-06T06:53:11Z</dc:date>
    <item>
      <title>Using Macro VAriable as Column Name Static Text in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Macro-VAriable-as-Column-Name-Static-Text-in-PROC-SQL/m-p/694766#M211904</link>
      <description>&lt;P&gt;Hello Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Im&amp;nbsp; setting a macro variable with a text value . Later im using this macro variable as a static string value in a SELECT statement in a PROC SQL while inserting rows. i using bquote to add single quotes to the static string but however i'm getting the error . What am i doing wrong ?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;25         %let CHARGE_TYPE = Generation (Post);
26         %let WHERE_CLAUSE = CASUBTRANS in ('1130', '1131');
27         


28         proc sql;
29         insert into BASE_UNBUND_REV_MONTHLY
30         
31         		select  RATELIT,
&lt;STRONG&gt;22: LINE and COLUMN cannot be determined.&lt;/STRONG&gt;
&lt;STRONG&gt;ERROR 22-322: Syntax error, expecting one of the following: a quoted string, !, !!, &amp;amp;, *, **, +, ',', -, /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;=, ?, 
              AND, AS, BETWEEN, CONTAINS, EQ, EQT, FORMAT, FROM, GE, GET, GT, GTT, IN, INFORMAT, INTO, IS, LABEL, LE, LEN, LENGTH, 
              LET, LIKE, LT, LTT, NE, NET, NOT, NOTIN, OR, TRANSCODE, ^, ^=, |, ||, ~, ~=.  
200: LINE and COLUMN cannot be determined.&lt;/STRONG&gt;
&lt;STRONG&gt;ERROR 200-322: The symbol is not recognized and will be ignored.
32         				%bquote('&amp;amp;CHARGE_TYPE.') as CHARGE_TYPE,
NOTE: Line generated by the macro function "BQUOTE".
32         'Generation (Post)'&lt;/STRONG&gt;
           _
           22
            _
            200
&lt;STRONG&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant, 
              a missing value, (, *, +, -, BTRIM, CALCULATED, CASE, EXISTS, INPUT, NOT, PUT, SUBSTRING, TRANSLATE, USER, ^, ~.  

ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/STRONG&gt;
33         				SUM(RM_BILLED_NETAMOUNT) as CHARGE
34         		from	BILLDOC_MOD_MONTHLY
35         		where	&amp;amp;WHERE_CLAUSE.
36         		group by	RATELIT
37         ;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%let CHARGE_TYPE = Generation (Post);
%let WHERE_CLAUSE = CASUBTRANS in ('1130', '1131');

proc sql;
insert into BASE_UNBUND_REV_MONTHLY  

		select  RATELIT,
				%bquote('&amp;amp;CHARGE_TYPE.') as CHARGE_TYPE,
				SUM(RM_BILLED_NETAMOUNT) as CHARGE
		from	BILLDOC_MOD_MONTHLY
		where	&amp;amp;WHERE_CLAUSE.
		group by	RATELIT
;		
run;&lt;/PRE&gt;&lt;P&gt;This is my code.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 09:10:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Macro-VAriable-as-Column-Name-Static-Text-in-PROC-SQL/m-p/694766#M211904</guid>
      <dc:creator>rajesh1980</dc:creator>
      <dc:date>2020-10-28T09:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: Using Macro VAriable as Column Name Static Text in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Macro-VAriable-as-Column-Name-Static-Text-in-PROC-SQL/m-p/694767#M211905</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/207999"&gt;@rajesh1980&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you tried using double quotes instead of single quotes in:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;'&amp;amp;CHARGE_TYPE.'&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Macro variables do not resolve when using single quotes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;
&lt;P&gt;Amir.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 09:16:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Macro-VAriable-as-Column-Name-Static-Text-in-PROC-SQL/m-p/694767#M211905</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2020-10-28T09:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: Using Macro VAriable as Column Name Static Text in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Macro-VAriable-as-Column-Name-Static-Text-in-PROC-SQL/m-p/694776#M211911</link>
      <description>&lt;P&gt;Why do you think you need %BQUOTE?&lt;/P&gt;
&lt;P&gt;This will work:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select
  RATELIT,
  "&amp;amp;CHARGE_TYPE." as CHARGE_TYPE,
  SUM(RM_BILLED_NETAMOUNT) as CHARGE
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 09:33:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Macro-VAriable-as-Column-Name-Static-Text-in-PROC-SQL/m-p/694776#M211911</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-10-28T09:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: Using Macro VAriable as Column Name Static Text in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Macro-VAriable-as-Column-Name-Static-Text-in-PROC-SQL/m-p/694958#M212000</link>
      <description>&lt;P&gt;Nn eof the options worked. I finally did this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;call symput('CHARGE_TYPE', quote(charge_type,"'"));&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Oct 2020 17:36:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Macro-VAriable-as-Column-Name-Static-Text-in-PROC-SQL/m-p/694958#M212000</guid>
      <dc:creator>rajesh1980</dc:creator>
      <dc:date>2020-10-28T17:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using Macro VAriable as Column Name Static Text in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Macro-VAriable-as-Column-Name-Static-Text-in-PROC-SQL/m-p/695031#M212025</link>
      <description>&lt;P&gt;This also works ( I assume you need single quotes as you are updating an external database):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select
  RATELIT,
  %str(%')&amp;amp;CHARGE_TYPE.%str(%') as CHARGE_TYPE,
  SUM(RM_BILLED_NETAMOUNT) as CHARGE&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Oct 2020 20:38:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Macro-VAriable-as-Column-Name-Static-Text-in-PROC-SQL/m-p/695031#M212025</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-10-28T20:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: Using Macro VAriable as Column Name Static Text in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Macro-VAriable-as-Column-Name-Static-Text-in-PROC-SQL/m-p/695044#M212037</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/207999"&gt;@rajesh1980&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Nn eof the options worked. I finally did this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;call symput('CHARGE_TYPE', quote(charge_type,"'"));&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It's unclear why you say this. Both the solution from &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; and &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/22588"&gt;@Amir&lt;/a&gt; will work, and are quite a bit simpler than CALL SYMPUT with the QUOTE() function (and using double quotes is better solution from a code readability and code maintainability point of view as well).&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 21:15:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Macro-VAriable-as-Column-Name-Static-Text-in-PROC-SQL/m-p/695044#M212037</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-10-28T21:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: Using Macro VAriable as Column Name Static Text in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Macro-VAriable-as-Column-Name-Static-Text-in-PROC-SQL/m-p/695336#M212174</link>
      <description>Sorry for being late on this. Yes i tried both &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; and &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/22588"&gt;@Amir&lt;/a&gt; solutions it wasnt still adding the quotes int he SQL. It was showing fine when i displayed it using %put. Hence i resorted to the solution mentioned above. .</description>
      <pubDate>Thu, 29 Oct 2020 19:51:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Macro-VAriable-as-Column-Name-Static-Text-in-PROC-SQL/m-p/695336#M212174</guid>
      <dc:creator>rajesh1980</dc:creator>
      <dc:date>2020-10-29T19:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: Using Macro VAriable as Column Name Static Text in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Macro-VAriable-as-Column-Name-Static-Text-in-PROC-SQL/m-p/697042#M212991</link>
      <description>&lt;P&gt;i can show you the problem im facing&lt;/P&gt;&lt;P&gt;This is the code im running, i have created a macro&amp;nbsp;SCE_OOR_REV_BILLING_FINANCE and it has PROC SQL statement with the macro Argument &amp;amp;CHARGE as a column name as well as text field. I used BQUOTE to add quotes to the macro variable but i am getting the following error.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%macro SCE_OOR_REV_BILLING_FINANCE(CHARGE=);
		proc sql;
			create table SCE_OOR_REV_BILLING_FINANCE as
				select 	CONTRACT,
						%bquote('&amp;amp;CHARGE') as CHARGE_DESC,
						sum(CHARGE.) as CHARGE
				from	(
								select
									contract,
									0 as LATE_PaAYMENT_CHARGE_COMM,
									0 as LATE_PaAYMENT_CHARGE_RESIDENTIAL,
									0 as RETURNED_CHECK_CHARGES,
									0 as SERVICE_CONNECTION_CHARGES_RES,
									0 as SERVICE_CONN_CHARGES_NON_RES,
									0 as SERVICE_CONN_CHARGES_AT_POLE,
									0 as OPTOUT_RESCARE_INIT_FEE,
									0 as OPTOUT_FERA_NON_CARE_IFEE,
									0 as RECOVER_UNAUTH_USE_ENERGY,
									0 as SERVICE_FEE_OPTIMAL_BILL,
									0 as AR_SERVICE_GUARANTEE,
									0 as CCA_INFORMATION_FEES,
									0 as DA_REVENUE,
									0 as DMS_SERVICE_FEE,
									OPT_OUT_RESCARE_MONTHLY,
									OPT_OUT_FERA_NONCARE_MONTHLY,
									ELECTRIC_SURCHARGE,
									SCE_ENERGY_MANAGER_FEE,
									CUST_FIN_ADDED_FAC_FERC,
									CUST_FIN_ADDED_FAC_CPUC,
									SCE_FIN_ADDED_FAC_FERC,
									SCE_FIN_ADDED_FAC_CPUC,
									CUST_FIN_IC_ADD_FAC_FERC,
									CUST_FIN_IC_ADD_FAC_CPUC,
									SCE_FIN_IC_ADD_FAC_FERC ,
									SCE_FIN_IC_ADD_FAC_CPUC

								from SCE_OOR_REV_BILLING
								union all
								select 
									contract,
									LATE_PaAYMENT_CHARGE_COMM,
									LATE_PaAYMENT_CHARGE_RESIDENTIAL,
									RETURNED_CHECK_CHARGES,
									SERVICE_CONNECTION_CHARGES_RES,
									SERVICE_CONN_CHARGES_NON_RES,
									SERVICE_CONN_CHARGES_AT_POLE,
									OPTOUT_RESCARE_INIT_FEE	,
									OPTOUT_FERA_NON_CARE_IFEE,
									RECOVER_UNAUTH_USE_ENERGY,
									SERVICE_FEE_OPTIMAL_BILL,
									AR_SERVICE_GUARANTEE,
									CCA_INFORMATION_FEES,
									DA_REVENUE,
									DMS_SERVICE_FEE,
									0 as 	OPT_OUT_RESCARE_MONTHLY,			
									0 as 	OPT_OUT_FERA_NONCARE_MONTHLY,
									0 as 	ELECTRIC_SURCHARGE,
									0 as 	SCE_ENERGY_MANAGER_FEE,
									0 as 	CUST_FIN_ADDED_FAC_FERC,
									0 as 	CUST_FIN_ADDED_FAC_CPUC,
									0 as 	SCE_FIN_ADDED_FAC_FERC,
									0 as 	SCE_FIN_ADDED_FAC_CPUC,
									0 as 	CUST_FIN_IC_ADD_FAC_FERC,
									0 as 	CUST_FIN_IC_ADD_FAC_CPUC,
									0 as 	SCE_FIN_IC_ADD_FAC_FERC,
									0 as 	SCE_FIN_IC_ADD_FAC_CPUC
								 FROM SCE_OOR_REV
					)
					group by	CONTRCAT
			;
		run;

%mend SCE_OOR_REV_BILLING_FINANCE;

%SCE_OOR_REV_BILLING_FINANCE(CHARGE=LATE_PaAYMENT_CHARGE_COMM);&lt;/PRE&gt;&lt;PRE&gt;99         %SCE_OOR_REV_BILLING_FINANCE(CHARGE=LATE_PaAYMENT_CHARGE_COMM);
NOTE: Line generated by the invoked macro "SCE_OOR_REV_BILLING_FINANCE".
99                        create table SCE_OOR_REV_BILLING_FINANCE as     select  CONTRACT,       %bquote('&amp;amp;CHARGE') as CHARGE_DESC,
99       !        sum(CHARGE.) as CHARGE     from (         select          contract,          0 as LATE_PaAYMENT_CHARGE_COMM,
                             _
                             &lt;STRONG&gt;22&lt;/STRONG&gt;
99       !     0 as
&lt;STRONG&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, *. &lt;/STRONG&gt; 

NOTE: Line generated by the macro function "BQUOTE".
&lt;STRONG&gt;99         'LATE_PaAYMENT_CHARGE_COMM'&lt;/STRONG&gt;
           _
           22
            _
&lt;STRONG&gt;            200
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant, 
              a missing value, (, *, +, -, BTRIM, CALCULATED, CASE, EXISTS, INPUT, NOT, PUT, SUBSTRING, TRANSLATE, USER, ^, ~.  
3                                                          The SAS System                    Thursday, November  5, 2020 06:05:00 PM&lt;/STRONG&gt;

&lt;STRONG&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/STRONG&gt;

NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
NOTE: PROC SQL statements are executed immediately; The RUN statement has no effect.&lt;/PRE&gt;&lt;P&gt;What makes it confusing is this&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: Line generated by the macro function "BQUOTE".&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;99 'LATE_PaAYMENT_CHARGE_COMM'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So it is resolving properly but somehow&amp;nbsp;PROC SQL is failing.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2020 04:33:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Macro-VAriable-as-Column-Name-Static-Text-in-PROC-SQL/m-p/697042#M212991</guid>
      <dc:creator>rajesh1980</dc:creator>
      <dc:date>2020-11-06T04:33:21Z</dc:date>
    </item>
    <item>
      <title>Re: Using Macro VAriable as Column Name Static Text in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Macro-VAriable-as-Column-Name-Static-Text-in-PROC-SQL/m-p/697058#M212997</link>
      <description>&lt;P&gt;SAS points you directly to your mistake, which is not in the %BQUOTE, but here:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;sum(CHARGE.)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;CHARGE. is not a valid column name in SQL. If CHARGE was a defined table alias or table name, then the name of a column from that table has to follow after the dot.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2020 06:05:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Macro-VAriable-as-Column-Name-Static-Text-in-PROC-SQL/m-p/697058#M212997</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-11-06T06:05:22Z</dc:date>
    </item>
    <item>
      <title>Re: Using Macro VAriable as Column Name Static Text in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Macro-VAriable-as-Column-Name-Static-Text-in-PROC-SQL/m-p/697064#M213002</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp; Sir, yeah i noticed that one too after i posted this, buit fixing that also did not resolve my issue. Still i am getting the same error. To test it out i wrote a small sample program which reproduces the error. If you can help me debug it, that would be great&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Program&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%macro test_macro(var=);
proc sql;
	create table test as 
		select %bquote('&amp;amp;var') as COLUMN1 from sashelp.class
		;
run;
%mend test_macro;

%test_macro(var=ABCD);&lt;/PRE&gt;&lt;P&gt;Output&lt;/P&gt;&lt;PRE&gt;1                                                          The SAS System                    Thursday, November  5, 2020 09:02:00 PM

1          ;*';*";*/;quit;run;
2          OPTIONS PAGENO=MIN;
3          %LET _CLIENTTASKLABEL='Program';
4          %LET _CLIENTPROCESSFLOWNAME='Process Flow';
5          %LET _CLIENTPROJECTPATH='';
6          %LET _CLIENTPROJECTPATHHOST='';
7          %LET _CLIENTPROJECTNAME='';
8          %LET _SASPROGRAMFILE='';
9          %LET _SASPROGRAMFILEHOST='';
10         
11         ODS _ALL_ CLOSE;
12         OPTIONS DEV=PNG;
13         FILENAME EGSR TEMP;
14         ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR
15             STYLE=HTMLBlue
16             STYLESHEET=(URL="file:///C:/Program%20Files/SASHome/SASEnterpriseGuide/7.1/Styles/HTMLBlue.css")
17             NOGTITLE
18             NOGFOOTNOTE
19             GPATH=&amp;amp;sasworklocation
20             ENCODING=UTF8
21             options(rolap="on")
22         ;
NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
23         
24         %macro test_macro(var=);
25         proc sql;
26         	create table test as
27         		select %bquote('&amp;amp;var') as COLUMN1 from sashelp.class
28         		;
29         run;
30         %mend test_macro;
31         
32         %test_macro(var=ABCD);
&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
NOTE: Line generated by the macro function "BQUOTE".
32         'ABCD'
           _
           22
            _
            200
NOTE: PROC SQL statements are executed immediately; The RUN statement has no effect.
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant, 
              a missing value, (, *, +, -, ALL, BTRIM, CALCULATED, CASE, DISTINCT, EXISTS, INPUT, NOT, PUT, SUBSTRING, TRANSLATE, 
              UNIQUE, USER, ^, ~.  

ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/STRONG&gt;&lt;/FONT&gt;

33         
34         %LET _CLIENTTASKLABEL=;
35         %LET _CLIENTPROCESSFLOWNAME=;
36         %LET _CLIENTPROJECTPATH=;
37         %LET _CLIENTPROJECTPATHHOST=;
38         %LET _CLIENTPROJECTNAME=;
39         %LET _SASPROGRAMFILE=;
40         %LET _SASPROGRAMFILEHOST=;
41         
42         ;*';*";*/;quit;
NOTE: The SAS System stopped processing this step because of errors.
2                                                          The SAS System                    Thursday, November  5, 2020 09:02:00 PM

NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      
42       !                run;
43         ODS _ALL_ CLOSE;
44         
45         
46         QUIT; RUN;
47         &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2020 06:53:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Macro-VAriable-as-Column-Name-Static-Text-in-PROC-SQL/m-p/697064#M213002</guid>
      <dc:creator>rajesh1980</dc:creator>
      <dc:date>2020-11-06T06:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: Using Macro VAriable as Column Name Static Text in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Macro-VAriable-as-Column-Name-Static-Text-in-PROC-SQL/m-p/697065#M213003</link>
      <description>&lt;P&gt;As I told you earlier, use double quotes and no %BQUOTE, and everything's fine. No need to overcomplicate things.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2020 06:57:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Macro-VAriable-as-Column-Name-Static-Text-in-PROC-SQL/m-p/697065#M213003</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-11-06T06:57:57Z</dc:date>
    </item>
    <item>
      <title>Re: Using Macro VAriable as Column Name Static Text in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Macro-VAriable-as-Column-Name-Static-Text-in-PROC-SQL/m-p/697066#M213004</link>
      <description>That was the most elegant solution ever!!! Thank you very much.</description>
      <pubDate>Fri, 06 Nov 2020 07:04:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Macro-VAriable-as-Column-Name-Static-Text-in-PROC-SQL/m-p/697066#M213004</guid>
      <dc:creator>rajesh1980</dc:creator>
      <dc:date>2020-11-06T07:04:01Z</dc:date>
    </item>
  </channel>
</rss>

