<?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: PROC SQL : error: ERROR: Syntax error at or near &amp;quot;.T&amp;quot; in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-error-ERROR-Syntax-error-at-or-near-quot-T-quot/m-p/860480#M339920</link>
    <description>Sorry , Can you please elaborate , What could be the correct syntax</description>
    <pubDate>Thu, 23 Feb 2023 15:53:58 GMT</pubDate>
    <dc:creator>Aexor</dc:creator>
    <dc:date>2023-02-23T15:53:58Z</dc:date>
    <item>
      <title>PROC SQL : error: ERROR: Syntax error at or near ".T"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-error-ERROR-Syntax-error-at-or-near-quot-T-quot/m-p/860436#M339910</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need suggestion for the error I am getting while creating table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since I have libray refernce having more than&amp;nbsp; 8 char. So I created a libref&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;like this&amp;nbsp;&lt;/P&gt;
&lt;P&gt;libname CAS_LIB&amp;nbsp; cas caslib="&amp;amp;mp_sourceName";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but whenever I am trying to create table using CAS_LIB as library . It is throwing error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have also inserted code for ref&lt;/P&gt;
&lt;PRE&gt;      
       proc casutil;
       load data =planning.ed_&amp;amp;inputTable CASOUT="ed_&amp;amp;inputTable" 
       OUTCASLIB="&amp;amp;mp_sourceName" replace;	   
	   
	   libname &amp;amp;vf_lib cas caslib="&amp;amp;mp_sourceName";

 
        proc fedsql SESSREF=&amp;amp;_SESSREF_;
            create table &amp;amp;vf_lib..tmp_&amp;amp;inputTable. as 
             select a.* ,b.time_id as start_dt_sk
             from 
                &amp;amp;vf_lib..&amp;amp;inputTable.  a, &amp;amp;vf_lib..ed_&amp;amp;inputTable  b  
            where 
                a.%bquote(&amp;amp;time_dim.) between b.start_date and b.end_date;
         quit;

    proc cas;
            sessionProp.setsessopt / caslib="&amp;amp;mp_sourceName";
             table.alterTable / columns={{rename="%TRIM(&amp;amp;prd_var)", 
    name="actual"},
                  {rename="%sysfunc(catx(_,&amp;amp;prd_var.,fcst))", name="predict"}}
              name="tmp_&amp;amp;inputTable.";
          quit;

/* This mp_source name have values like CASUSER(CMSTEST), ShoppingInsight  , ModelValuation , etc */ &lt;/PRE&gt;
&lt;P&gt;ernce.&lt;/P&gt;
&lt;P&gt;normal: MPRINT(X): proc casutil;&lt;BR /&gt;note: NOTE: The UUID '3887c308-3320-8d4d-81f1-b24a9322bcac' is connected using session CASAUTO.&lt;BR /&gt;normal: SYMBOLGEN: Macro variable PLAN_LIB resolves to planning&lt;BR /&gt;normal: SYMBOLGEN: Macro variable INPUTTABLE resolves to OUTFOR_102&lt;BR /&gt;normal: SYMBOLGEN: Macro variable INPUTTABLE resolves to OUTFOR_102&lt;BR /&gt;normal: SYMBOLGEN: &amp;amp;&amp;amp; resolves to &amp;amp;.&lt;BR /&gt;normal: SYMBOLGEN: Macro variable MP_SOURCENAME resolves to CASUSER(cmstest)&lt;BR /&gt;normal: MPRINT(X): load data =planning.ed_OUTFOR_102 CASOUT="ed_OUTFOR_102" OUTCASLIB="CASUSER(cmstest)" replace;&lt;BR /&gt;note: NOTE: PLANNING.ED_OUTFOR_102 was successfully added to the "CASUSER(cmstest)" caslib as "ED_OUTFOR_102".&lt;BR /&gt;normal: SYMBOLGEN: Macro variable VF_LIB resolves to CAS_LIB&lt;BR /&gt;normal: SYMBOLGEN: Macro variable MP_SOURCENAME resolves to CASUSER(cmstest)&lt;BR /&gt;normal: MPRINT(NPF_INPUT_CDL_FACT): libname CAS_LIB cas caslib="CASUSER(cmstest)";&lt;BR /&gt;note: NOTE: Libref CAS_LIB was successfully assigned as follows: &lt;BR /&gt;note: Engine: CAS &lt;BR /&gt;note: Physical Name: 3887c308-3320-8d4d-81f1-b24a9322bcac&lt;BR /&gt;note: NOTE: PROCEDURE CASUTIL used (Total process time):&lt;BR /&gt;note: real time 0.28 seconds&lt;BR /&gt;note: cpu time 0.05 seconds&lt;BR /&gt;note: &lt;BR /&gt;note: &lt;BR /&gt;normal: SYMBOLGEN: Macro variable _SESSREF_ resolves to CASAUTO&lt;BR /&gt;normal: MPRINT(X): proc fedsql SESSREF=CASAUTO;&lt;BR /&gt;normal: SYMBOLGEN: Macro variable MP_SOURCENAME resolves to CASUSER(cmstest)&lt;BR /&gt;normal: SYMBOLGEN: Macro variable INPUTTABLE resolves to OUTFOR_102&lt;BR /&gt;title: 17 The SAS System Wednesday, February 22, 2023 05:25:00 PM&lt;BR /&gt;title: &lt;BR /&gt;normal: SYMBOLGEN: Macro variable MP_SOURCENAME resolves to CASUSER(cmstest)&lt;BR /&gt;normal: SYMBOLGEN: Macro variable INPUTTABLE resolves to OUTFOR_102&lt;BR /&gt;normal: SYMBOLGEN: Macro variable MP_SOURCENAME resolves to CASUSER(cmstest)&lt;BR /&gt;normal: SYMBOLGEN: Macro variable INPUTTABLE resolves to OUTFOR_102&lt;BR /&gt;normal: SYMBOLGEN: Macro variable TIME_DIM resolves to start_date &lt;BR /&gt;normal: MPRINT(X): create table CASUSER(cmstest).tmp_OUTFOR_102 as select a.* ,b.time_id as start_dt_sk from &lt;BR /&gt;normal: CASUSER(cmstest).OUTFOR_102 a, CASUSER(cpstest).ed_OUTFOR_102 b where a.start_date between b.start_date and b.end_date;&lt;BR /&gt;error: ERROR: Syntax error at or near ".T"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2023 14:06:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-error-ERROR-Syntax-error-at-or-near-quot-T-quot/m-p/860436#M339910</guid>
      <dc:creator>Aexor</dc:creator>
      <dc:date>2023-02-23T14:06:17Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL : error: ERROR: Syntax error at or near ".T"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-error-ERROR-Syntax-error-at-or-near-quot-T-quot/m-p/860458#M339912</link>
      <description>&lt;P&gt;Maybe it's about my ignorance, but I don't recognise this syntax:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;create table &lt;STRONG&gt;&lt;EM&gt;CASUSER(cmstest)&lt;/EM&gt;&lt;/STRONG&gt;.tmp_OUTFOR_102&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2023 14:41:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-error-ERROR-Syntax-error-at-or-near-quot-T-quot/m-p/860458#M339912</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2023-02-23T14:41:36Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL : error: ERROR: Syntax error at or near ".T"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-error-ERROR-Syntax-error-at-or-near-quot-T-quot/m-p/860469#M339915</link>
      <description>&lt;P&gt;I suggest trying to replicate the problem with a much simpler sample bit of code. In particular, replace all the macro variable references with hard code.&amp;nbsp; &amp;nbsp; If the PROC CAS step is not needed to produce the error, remove it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It looks to me like your macro variable VF_LIB is resolving to&amp;nbsp;&lt;SPAN&gt;CASUSER(cmstest), I think you expect it to resolve to&amp;nbsp; CAS_LIB.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I don't know CAS or FEDSQL&amp;nbsp; Is PROC FEDSQL actually executing on a different SAS session?&amp;nbsp; (I see SESSREF=).&amp;nbsp; Could the macro variable VF_LIB&amp;nbsp; have a different value in that session?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2023 15:27:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-error-ERROR-Syntax-error-at-or-near-quot-T-quot/m-p/860469#M339915</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-02-23T15:27:53Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL : error: ERROR: Syntax error at or near ".T"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-error-ERROR-Syntax-error-at-or-near-quot-T-quot/m-p/860478#M339919</link>
      <description>Thank you for your suggestion. I will try this.&lt;BR /&gt;&lt;BR /&gt;VF_LIB = CAS_LIB throughout the session . &lt;BR /&gt;I have used CAS_LIB as libname to avoid using libref which is more than 8 char .&lt;BR /&gt;&lt;BR /&gt;I want tables to be created in CAS_LIB and I want those tables to get accessed  in later steps to which is not happening.&lt;BR /&gt;&lt;BR /&gt;if you check the attached code . I have mentioned the code steps .</description>
      <pubDate>Thu, 23 Feb 2023 15:52:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-error-ERROR-Syntax-error-at-or-near-quot-T-quot/m-p/860478#M339919</guid>
      <dc:creator>Aexor</dc:creator>
      <dc:date>2023-02-23T15:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL : error: ERROR: Syntax error at or near ".T"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-error-ERROR-Syntax-error-at-or-near-quot-T-quot/m-p/860480#M339920</link>
      <description>Sorry , Can you please elaborate , What could be the correct syntax</description>
      <pubDate>Thu, 23 Feb 2023 15:53:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-error-ERROR-Syntax-error-at-or-near-quot-T-quot/m-p/860480#M339920</guid>
      <dc:creator>Aexor</dc:creator>
      <dc:date>2023-02-23T15:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL : error: ERROR: Syntax error at or near ".T"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-error-ERROR-Syntax-error-at-or-near-quot-T-quot/m-p/860485#M339923</link>
      <description>&lt;P&gt;Yes, I see the code steps, but the MPRINT output is confusing to me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It looks like this code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;create table &amp;amp;vf_lib..tmp_&amp;amp;inputTable. as&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is somehow resolving to:&lt;/P&gt;
&lt;PRE&gt;normal: MPRINT(X): create table CASUSER(cmstest).tmp_OUTFOR_102 as&lt;/PRE&gt;
&lt;P&gt;which doesn't make sense to me and shouldn't happen if the macro variable VF_LIB has the value CAS_LIB.&amp;nbsp; Unless it's possible that the MPRINT log you showed is not from the code you shared.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thus my suggestion to replace the macro variables with the hard-coded code you are intending to generate, e.g.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;create table cas_lib.tmp_OUTFOR_102 as&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If that code works, then you know the problem is somewhere in your macro variable resolution.&amp;nbsp; And it it doesn't work, then it will be easier to debug without all the macro variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Common advice is to debug the SAS code first and get that working, then add macro complexity and debug that.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2023 16:06:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-error-ERROR-Syntax-error-at-or-near-quot-T-quot/m-p/860485#M339923</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-02-23T16:06:22Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL : error: ERROR: Syntax error at or near ".T"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-error-ERROR-Syntax-error-at-or-near-quot-T-quot/m-p/860509#M339938</link>
      <description>I am getting this error . Thought in previous step CAS_LIB is working fine.  am I missing anything here. Please help &lt;BR /&gt;&lt;BR /&gt;proc fedsql ; create table CAS_LIB.tmp_OUTFOR_102 as select a.* ,b.time_id as start_dt_sk from CAS_LIB.OUTFOR_102 &lt;BR /&gt;normal: a, CAS_LIB.ed_OUTFOR_102 b where a.start_date between b.start_date and b.end_date;&lt;BR /&gt;error: ERROR: Table "CAS_LIB.OUTFOR_102" does not exist or cannot be accessed&lt;BR /&gt;error: ERROR: BASE driver, schema name CAS_LIB was not found for this connection</description>
      <pubDate>Thu, 23 Feb 2023 18:06:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-error-ERROR-Syntax-error-at-or-near-quot-T-quot/m-p/860509#M339938</guid>
      <dc:creator>Aexor</dc:creator>
      <dc:date>2023-02-23T18:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL : error: ERROR: Syntax error at or near ".T"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-error-ERROR-Syntax-error-at-or-near-quot-T-quot/m-p/860519#M339942</link>
      <description>&lt;P&gt;Sorry, I'm not a FEDSQL person or a CAS person, so I won't be able to help.&amp;nbsp; I'd suggest posting the full PROC FEDSQL step you are running (with no macro vars) and the full log.&amp;nbsp; Then maybe you'll get lucky and someone like&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13728"&gt;@SASJedi&lt;/a&gt;&amp;nbsp;will wander by and lend you a hand.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2023 18:28:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-error-ERROR-Syntax-error-at-or-near-quot-T-quot/m-p/860519#M339942</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-02-23T18:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL : error: ERROR: Syntax error at or near ".T"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-error-ERROR-Syntax-error-at-or-near-quot-T-quot/m-p/863188#M340991</link>
      <description>&lt;OL&gt;
&lt;LI&gt;When PROC FedSQL executes code on the SAS Compute Server (what you might call base SAS), it can ONLY access data from non-concatenated SAS libraries which are not associated with a caslib. When executing in CAS (as indicated by the presence of the SESSREF= option on the PROC FedSQL statement) it can ONLY access data in caslibs.&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;When you are operating in a multi-user CAS session, every user has a caslib named CASUSER. In order to differentiate your&amp;nbsp;CASUSER caslib from other users, the system identifies the caslib as CASUSER(userID).&amp;nbsp; So you need to use the actual CASLIB name for this, not the libref. Of course, the caslib name will seem inappropriate to the FedSQL compiler because of the included punctuation.&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;To make the name work as is, you can add double quotes to indicate that the text is a valid name, something like this:&lt;/LI&gt;
&lt;/OL&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc fedsql SESSREF=&amp;amp;_SESSREF_;
create table "&amp;amp;mp_sourceName"."tmp_&amp;amp;inputTable" as 
	select a.* 
		  ,b.time_id as start_dt_sk 
		from "&amp;amp;mp_sourceName"."&amp;amp;inputTable"  a 
			"&amp;amp;mp_sourceName"."ed_&amp;amp;inputTable" b 
		where a.%bquote(&amp;amp;time_dim.) between b.start_date and b.end_date
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I hope this helps.&lt;/P&gt;
&lt;P&gt;Mark&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 14:01:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-error-ERROR-Syntax-error-at-or-near-quot-T-quot/m-p/863188#M340991</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2023-03-09T14:01:18Z</dc:date>
    </item>
  </channel>
</rss>

