<?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: %sysfunc -&amp;gt; store value in table in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/sysfunc-gt-store-value-in-table/m-p/540366#M7220</link>
    <description>THANK'S</description>
    <pubDate>Tue, 05 Mar 2019 08:34:03 GMT</pubDate>
    <dc:creator>Cello23</dc:creator>
    <dc:date>2019-03-05T08:34:03Z</dc:date>
    <item>
      <title>%sysfunc -&gt; store value in table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/sysfunc-gt-store-value-in-table/m-p/540278#M7203</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;i have write this macro:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro date_loop(start,end);
   %let start=%sysfunc(inputn(&amp;amp;start,DATETIME16.));
   %let end=%sysfunc(inputn(&amp;amp;end,DATETIME16.));
   %let dif=%sysfunc(intck(HOUR,&amp;amp;start,&amp;amp;end));
     %do i=0 %to &amp;amp;dif;
      %let date=%sysfunc(intnx(HOUR,&amp;amp;start,&amp;amp;i,b),DATETIME16.);
      %put &amp;amp;date;


	data LDS.aA01_PROVA;
    TM_INS_C = &amp;amp;date ;
	FORMAT TM_INS_C DATETIME16.;
 	run;

 
     %end;
   %mend date_loop;

   %date_loop(01JAN19:00:00:00,01JAN19:00:01:59);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to store the value of&amp;nbsp;&lt;CODE class=" language-sas"&gt;variabile &amp;amp;date&amp;nbsp; in table&amp;nbsp;LDS.aA01_PROVA, but i recived this error:&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;8986  %macro date_loop(start,end);
8987     %let start=%sysfunc(inputn(&amp;amp;start,DATETIME16.));
8988     %let end=%sysfunc(inputn(&amp;amp;end,DATETIME16.));
8989     %let dif=%sysfunc(intck(HOUR,&amp;amp;start,&amp;amp;end));
8990       %do i=0 %to &amp;amp;dif;
8991        %let date=%sysfunc(intnx(HOUR,&amp;amp;start,&amp;amp;i,b),DATETIME16.);
8992        %put &amp;amp;date;
8993
8994
8995      data LDS.aA01_PROVA;
8996      TM_INS_C = &amp;amp;date ;
8997      FORMAT TM_INS_C DATETIME16.;
8998      run;
8999
9000
9001
9002
9003       %end;
9004     %mend date_loop;
9005
9006     %date_loop(01JAN19:00:00:00,01JAN19:00:01:59);
01JAN19:00:00:00

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set LDS.AA01_PROVA may be incomplete.  When this step was stopped there were 0
         observations and 1 variables.
WARNING: Data set LDS.AA01_PROVA was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.11 seconds
      cpu time            0.04 seconds

NOTE: Line generated by the macro variable "DATE".
1      01JAN19:00:00:00
         -----
         388
         76

ERROR 388-185: Expecting an arithmetic operator.

ERROR 76-322: Syntax error, statement will be ignored.
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;What is my mistake ?&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;thank's much&lt;/CODE&gt;!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2019 22:48:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/sysfunc-gt-store-value-in-table/m-p/540278#M7203</guid>
      <dc:creator>Cello23</dc:creator>
      <dc:date>2019-03-04T22:48:02Z</dc:date>
    </item>
    <item>
      <title>Re: %sysfunc -&gt; store value in table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/sysfunc-gt-store-value-in-table/m-p/540282#M7204</link>
      <description>&lt;P&gt;No need to format your macro variable as human readable dates. In fact, that is the cause of the error you got.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro date_loop(start,end);
    %let dif=%sysfunc(intck(HOUR,"&amp;amp;start"dt,"&amp;amp;end"dt));
    %do i=0 %to &amp;amp;dif;
        %let date=%sysfunc(intnx(HOUR,&amp;amp;start,&amp;amp;i,b));
        %put &amp;amp;=date;

        data LDS.aA01_PROVA;
            TM_INS_C = &amp;amp;date ;
            FORMAT TM_INS_C DATETIME16.;
        run;
    %end;
%mend date_loop;
%date_loop(01JAN19:00:00:00,01JAN19:00:01:59)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Mar 2019 23:22:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/sysfunc-gt-store-value-in-table/m-p/540282#M7204</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-03-04T23:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: %sysfunc -&gt; store value in table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/sysfunc-gt-store-value-in-table/m-p/540293#M7205</link>
      <description>&lt;P&gt;To elaborate on what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;is saying and the impact it has, look at the results of the %PUT statement on line 8992.&amp;nbsp; It generates:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token number"&gt;01&lt;/SPAN&gt;JAN19:&lt;SPAN class="token number"&gt;00&lt;/SPAN&gt;:&lt;SPAN class="token number"&gt;00&lt;/SPAN&gt;:&lt;SPAN class="token number"&gt;00&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then look at how you use the macro variable later, on line 8996:&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;TM_INS_C &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;date&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;That generates an erroneous SAS statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;TM_INS_C &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; 01JAN19:00:00:00&amp;nbsp;;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That's where you get the error message.&amp;nbsp; One proper version of the statement would be:&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;TM_INS_C &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; "&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;date"dt&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or, as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;mentioned, you could just leave &amp;amp;DATE unformatted, holding the proper numeric value that could be assigned using:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;TM_INS_C &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;date&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Mar 2019 23:35:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/sysfunc-gt-store-value-in-table/m-p/540293#M7205</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-03-04T23:35:22Z</dc:date>
    </item>
    <item>
      <title>Re: %sysfunc -&gt; store value in table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/sysfunc-gt-store-value-in-table/m-p/540365#M7219</link>
      <description>THANK'S SO MUCH!!</description>
      <pubDate>Tue, 05 Mar 2019 08:33:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/sysfunc-gt-store-value-in-table/m-p/540365#M7219</guid>
      <dc:creator>Cello23</dc:creator>
      <dc:date>2019-03-05T08:33:46Z</dc:date>
    </item>
    <item>
      <title>Re: %sysfunc -&gt; store value in table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/sysfunc-gt-store-value-in-table/m-p/540366#M7220</link>
      <description>THANK'S</description>
      <pubDate>Tue, 05 Mar 2019 08:34:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/sysfunc-gt-store-value-in-table/m-p/540366#M7220</guid>
      <dc:creator>Cello23</dc:creator>
      <dc:date>2019-03-05T08:34:03Z</dc:date>
    </item>
  </channel>
</rss>

