<?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: PUTC function to convert macro variable DATE field YYMMDD10. format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PUTC-function-to-convert-macro-variable-DATE-field-YYMMDD10/m-p/359029#M84428</link>
    <description>&lt;P&gt;So sayeth &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;You could apply ORACLE functions to the variables in the pass through code. &amp;nbsp;But if you want to apply SAS function to them you will need to do that on the SAS side of the query.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Excellent point.&lt;/P&gt;</description>
    <pubDate>Tue, 16 May 2017 13:51:08 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2017-05-16T13:51:08Z</dc:date>
    <item>
      <title>PUTC function to convert macro variable DATE field YYMMDD10. format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PUTC-function-to-convert-macro-variable-DATE-field-YYMMDD10/m-p/359004#M84410</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi SAS USers,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I needed some help in the below code &amp;nbsp;where i am using DATE format field (&amp;amp;nqt_fos, &amp;amp;nqt_los) &amp;nbsp;to convert to YYYYMMDD10. format . I am getting missing expression error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;connect to oracle(user=&amp;amp;myid orapw=&amp;amp;mypwd path="&amp;amp;mydb");&lt;BR /&gt;create table test as select * from connection to oracle&lt;BR /&gt;(select distinct&lt;BR /&gt;case_id,&lt;BR /&gt;%sysfunc(PUTC(a.&amp;amp;nqt_fos, YYMMDD10.)) as nqt_fos,&amp;nbsp;&lt;BR /&gt;%sysfunc(PUTC(a.&amp;amp;nqt_los, YYMMDD10.)) as nqt_los,&lt;/P&gt;&lt;P&gt;paid_amt&lt;/P&gt;&lt;P&gt;);&lt;BR /&gt;disconnect from oracle;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ana&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2017 13:10:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PUTC-function-to-convert-macro-variable-DATE-field-YYMMDD10/m-p/359004#M84410</guid>
      <dc:creator>SASAna</dc:creator>
      <dc:date>2017-05-16T13:10:59Z</dc:date>
    </item>
    <item>
      <title>Re: PUTC function to convert macro variable DATE field YYMMDD10. format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PUTC-function-to-convert-macro-variable-DATE-field-YYMMDD10/m-p/359007#M84412</link>
      <description>&lt;P&gt;Have you tried using PUTN instead of PUTC?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can we see more of the code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can we see the SASLOG?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do macro variables &amp;amp;nqt_fos and &amp;amp;nqt_los have a value? What is their value?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why do use the a. in a.&amp;amp;nqt_fox and a.&amp;amp;nqt_los??&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2017 13:15:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PUTC-function-to-convert-macro-variable-DATE-field-YYMMDD10/m-p/359007#M84412</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-05-16T13:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: PUTC function to convert macro variable DATE field YYMMDD10. format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PUTC-function-to-convert-macro-variable-DATE-field-YYMMDD10/m-p/359010#M84414</link>
      <description>&lt;P&gt;Create your required macrovariable in call symput in data _null_ step and then use it in explicit pass through. SAS functions and Macro functions in connect statement i.e. in explicit pass through.&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2017 13:17:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PUTC-function-to-convert-macro-variable-DATE-field-YYMMDD10/m-p/359010#M84414</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2017-05-16T13:17:29Z</dc:date>
    </item>
    <item>
      <title>Re: PUTC function to convert macro variable DATE field YYMMDD10. format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PUTC-function-to-convert-macro-variable-DATE-field-YYMMDD10/m-p/359018#M84420</link>
      <description>&lt;P&gt;Hi Paige,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the example and rest of the code would be -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dates are being passed to a macro variables nqt_fos &amp;amp; nqt_los.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%LET nqt_fos = date1 ; &amp;nbsp; ( &amp;nbsp; Ex : &amp;nbsp;12/5/2014 12:00:00AM)&lt;/P&gt;&lt;P&gt;%LET nqt_los = date2 ; &amp;nbsp; &amp;nbsp;(Ex: &amp;nbsp;15/6/2014 12:00:00AM)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SQL is called like the above code to change them into charcter YYMMDD10. format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ana&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2017 13:31:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PUTC-function-to-convert-macro-variable-DATE-field-YYMMDD10/m-p/359018#M84420</guid>
      <dc:creator>SASAna</dc:creator>
      <dc:date>2017-05-16T13:31:30Z</dc:date>
    </item>
    <item>
      <title>Re: PUTC function to convert macro variable DATE field YYMMDD10. format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PUTC-function-to-convert-macro-variable-DATE-field-YYMMDD10/m-p/359019#M84421</link>
      <description>&lt;P&gt;What do your macro variables contain?&lt;/P&gt;
&lt;P&gt;To use with %SYSFUNC(PUTN()) they should contain text version of date, either an actual number or a date literal.&lt;/P&gt;
&lt;P&gt;But you are adding an alias prefix to them in your SQL as if you assumed they were going to be variable NAMES.&lt;/P&gt;
&lt;P&gt;Let's assume that what you want to do is change the names of the variables you are pulling from the external database.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;create table test as
select * from connection to oracle
  (select distinct
     case_id
   , &amp;amp;nqt_fos as nqt_fos
   , &amp;amp;nqt_los as nqt_los
   , paid_amt
  )
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You could apply ORACLE functions to the variables in the pass through code. &amp;nbsp;But if you want to apply SAS function to them you will need to do that on the SAS side of the query.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;create table test as
select
    case_id
  , put(datepart(nqt_fos),YYMMDDN10.) as char_nqt_fos
  , put(datepart(nqt_los),YYMMDDN10.) as char_nqt_los
  , paid_amt
 from connection to oracle
  (select distinct
     case_id
   , &amp;amp;nqt_fos as nqt_fos
   , &amp;amp;nqt_los as nqt_los
   , paid_amt
  from some_table
  )
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2017 13:42:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PUTC-function-to-convert-macro-variable-DATE-field-YYMMDD10/m-p/359019#M84421</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-05-16T13:42:29Z</dc:date>
    </item>
    <item>
      <title>Re: PUTC function to convert macro variable DATE field YYMMDD10. format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PUTC-function-to-convert-macro-variable-DATE-field-YYMMDD10/m-p/359020#M84422</link>
      <description>&lt;P&gt;Many basic concepts need to be addressed ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why should %SYSFUNC be part of the solution?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why are you referring to an alias named "a" when no such alias has been defined in the SQL code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why does your SQL code fail to mention the name of the source table?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2017 13:33:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PUTC-function-to-convert-macro-variable-DATE-field-YYMMDD10/m-p/359020#M84422</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-05-16T13:33:45Z</dc:date>
    </item>
    <item>
      <title>Re: PUTC function to convert macro variable DATE field YYMMDD10. format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PUTC-function-to-convert-macro-variable-DATE-field-YYMMDD10/m-p/359021#M84423</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/86567"&gt;@SASAna&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi Paige,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is the example and rest of the code would be -&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;dates are being passed to a macro variables nqt_fos &amp;amp; nqt_los.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%LET nqt_fos = date1 ; &amp;nbsp; ( &amp;nbsp; Ex : &amp;nbsp;12/5/2014 12:00:00AM)&lt;/P&gt;
&lt;P&gt;%LET nqt_los = date2 ; &amp;nbsp; &amp;nbsp;(Ex: &amp;nbsp;15/6/2014 12:00:00AM)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC SQL is called like the above code to change them into charcter YYMMDD10. format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Ana&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;In this case, you could use the ANYDTDTM informat (not format), you don't need the "a." in front of your variable names, %SYSFUNC is completely unnecessary, something like (untested code)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input(&amp;amp;nqt_fos,anydtdtm.) as nqt_fos&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 May 2017 13:46:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PUTC-function-to-convert-macro-variable-DATE-field-YYMMDD10/m-p/359021#M84423</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-05-16T13:46:02Z</dc:date>
    </item>
    <item>
      <title>Re: PUTC function to convert macro variable DATE field YYMMDD10. format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PUTC-function-to-convert-macro-variable-DATE-field-YYMMDD10/m-p/359029#M84428</link>
      <description>&lt;P&gt;So sayeth &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;You could apply ORACLE functions to the variables in the pass through code. &amp;nbsp;But if you want to apply SAS function to them you will need to do that on the SAS side of the query.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Excellent point.&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2017 13:51:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PUTC-function-to-convert-macro-variable-DATE-field-YYMMDD10/m-p/359029#M84428</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-05-16T13:51:08Z</dc:date>
    </item>
  </channel>
</rss>

