<?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 Connection to ODBC in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Connection-to-ODBC/m-p/884992#M39281</link>
    <description>&lt;P&gt;Hi all, seeking help on the coding below.&lt;/P&gt;&lt;P&gt;I would like to set %let statement to read the period equal to 2 months after begin date.&amp;nbsp; &lt;FONT size="2"&gt;&lt;EM&gt;(i.e. 202304)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;If i direct set period_YM = 202304, the program is works. However, instead of direct set the period_YM, i would like to build a %let statement to calculate in future.&lt;/P&gt;&lt;P&gt;But, the error pop up as below. Would like to seek any solution to solve this issue?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ERROR: CLI describe error: [Oracle][ODBC][Ora]ORA-00907: missing right parenthesis : [Oracle][ODBC]Invalid descriptor index &amp;lt;1&amp;gt;.&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%let begin = 202302;&lt;BR /&gt;
%let period 	= "%sysfunc(intnx(month,%sysfunc(inputN(&amp;amp;begin.01,yymmdd10.)),+2),date9.)"d;
%let period_YM 	= input(substr(put(&amp;amp;period., yymmddn8.),1, 6), 6.);

Proc sql;
CONNECT TO ODBC (DATAsrc=KPODA01 USER=&amp;amp;OD_USER_ID PASSWORD=&amp;amp;OD_PASSWORD);
CREATE TABLE working.output as select * from connection to ODBC
(select distinct 
    Column 1,
    Column 2
from oracle.File_Name_&amp;amp;period_YM.);

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 17 Jul 2023 06:12:05 GMT</pubDate>
    <dc:creator>Michelle_</dc:creator>
    <dc:date>2023-07-17T06:12:05Z</dc:date>
    <item>
      <title>Connection to ODBC</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Connection-to-ODBC/m-p/884992#M39281</link>
      <description>&lt;P&gt;Hi all, seeking help on the coding below.&lt;/P&gt;&lt;P&gt;I would like to set %let statement to read the period equal to 2 months after begin date.&amp;nbsp; &lt;FONT size="2"&gt;&lt;EM&gt;(i.e. 202304)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;If i direct set period_YM = 202304, the program is works. However, instead of direct set the period_YM, i would like to build a %let statement to calculate in future.&lt;/P&gt;&lt;P&gt;But, the error pop up as below. Would like to seek any solution to solve this issue?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ERROR: CLI describe error: [Oracle][ODBC][Ora]ORA-00907: missing right parenthesis : [Oracle][ODBC]Invalid descriptor index &amp;lt;1&amp;gt;.&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%let begin = 202302;&lt;BR /&gt;
%let period 	= "%sysfunc(intnx(month,%sysfunc(inputN(&amp;amp;begin.01,yymmdd10.)),+2),date9.)"d;
%let period_YM 	= input(substr(put(&amp;amp;period., yymmddn8.),1, 6), 6.);

Proc sql;
CONNECT TO ODBC (DATAsrc=KPODA01 USER=&amp;amp;OD_USER_ID PASSWORD=&amp;amp;OD_PASSWORD);
CREATE TABLE working.output as select * from connection to ODBC
(select distinct 
    Column 1,
    Column 2
from oracle.File_Name_&amp;amp;period_YM.);

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2023 06:12:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Connection-to-ODBC/m-p/884992#M39281</guid>
      <dc:creator>Michelle_</dc:creator>
      <dc:date>2023-07-17T06:12:05Z</dc:date>
    </item>
    <item>
      <title>Re: Connection to ODBC</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Connection-to-ODBC/m-p/885004#M39282</link>
      <description>&lt;P&gt;If you place the code below after the last %let and verify the log you will see why it is not working as you want.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put begin = &amp;amp;begin.;
%put period = &amp;amp;period.;
%put period_YM = &amp;amp;period_YM.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I suggest to use for the %let period_YM statement something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let period_YM 	= %sysfunc(inputn(%sysfunc(substr(%sysfunc(putn(&amp;amp;period., yymmddn8.)),1, 6)), 6.));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 Jul 2023 08:29:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Connection-to-ODBC/m-p/885004#M39282</guid>
      <dc:creator>JosvanderVelden</dc:creator>
      <dc:date>2023-07-17T08:29:57Z</dc:date>
    </item>
    <item>
      <title>Re: Connection to ODBC</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Connection-to-ODBC/m-p/885005#M39283</link>
      <description>&lt;P&gt;If you want a value of 202304 why did you 1) apply a date9 format, include quotes and the d character?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One suggestion:&lt;/P&gt;
&lt;PRE&gt;%let begin = 202302;

%let period 	= %sysfunc(intnx(month,%sysfunc(inputN(&amp;amp;begin,yymmn6.)),+2),yymmddn8.);
&lt;/PRE&gt;
&lt;P&gt;Note use of the YYMMN6 informat to imply the day of the month to be one.&lt;/P&gt;
&lt;P&gt;If you are using the date value of period elsewhere such as for comparison create a separate variable and do not format it all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/446019"&gt;@Michelle_&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi all, seeking help on the coding below.&lt;/P&gt;
&lt;P&gt;I would like to set %let statement to read the period equal to 2 months after begin date.&amp;nbsp; &lt;FONT size="2"&gt;&lt;EM&gt;(i.e. 202304)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;If i direct set period_YM = 202304, the program is works. However, instead of direct set the period_YM, i would like to build a %let statement to calculate in future.&lt;/P&gt;
&lt;P&gt;But, the error pop up as below. Would like to seek any solution to solve this issue?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ERROR: CLI describe error: [Oracle][ODBC][Ora]ORA-00907: missing right parenthesis : [Oracle][ODBC]Invalid descriptor index &amp;lt;1&amp;gt;.&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;%let begin = 202302;&lt;BR /&gt;
%let period 	= "%sysfunc(intnx(month,%sysfunc(inputN(&amp;amp;begin.01,yymmdd10.)),+2),date9.)"d;
%let period_YM 	= input(substr(put(&amp;amp;period., yymmddn8.),1, 6), 6.);

Proc sql;
CONNECT TO ODBC (DATAsrc=KPODA01 USER=&amp;amp;OD_USER_ID PASSWORD=&amp;amp;OD_PASSWORD);
CREATE TABLE working.output as select * from connection to ODBC
(select distinct 
    Column 1,
    Column 2
from oracle.File_Name_&amp;amp;period_YM.);

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2023 08:30:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Connection-to-ODBC/m-p/885005#M39283</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-07-17T08:30:41Z</dc:date>
    </item>
    <item>
      <title>Re: Connection to ODBC</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Connection-to-ODBC/m-p/885061#M39286</link>
      <description>It works. I have to add the %sysfunc in the &amp;amp;period_YM too. Thanks!</description>
      <pubDate>Mon, 17 Jul 2023 13:12:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Connection-to-ODBC/m-p/885061#M39286</guid>
      <dc:creator>Michelle_</dc:creator>
      <dc:date>2023-07-17T13:12:16Z</dc:date>
    </item>
  </channel>
</rss>

