<?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 How to make the code work in rolling window analysis in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-make-the-code-work-in-rolling-window-analysis/m-p/238640#M268314</link>
    <description>&lt;P&gt;The following code is provided by&amp;nbsp;data_null__ for my prior question. the code works perfect when there do exist&amp;nbsp;empty datasets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I tried to apply it to rolling window regression.&amp;nbsp;some rolling windows' regressions generate empty tables, while other rolling windows' regressions do not generate empty tables. &amp;nbsp;The SAS program stop in the rolling window where there is no empty table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway to force the program to continue processing when there is no empty table? Thanks a lot!&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;proc sql noprint; 
   select memname into :zero separated by ' '
      from dictionary.tables 
      where libname eq 'WORK' and memname eqt 'HAVE_' and nobs eq 0; 
   quit; 
   run; 
%put NOTE: &amp;amp;=zero;
data &amp;amp;zero;
   do _n_ = 1 to 3; 
      output; 
      end; 
   stop; 
   set &amp;amp;zero;
   run; &lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Dec 2015 08:03:01 GMT</pubDate>
    <dc:creator>Jonate_H</dc:creator>
    <dc:date>2015-12-10T08:03:01Z</dc:date>
    <item>
      <title>How to make the code work in rolling window analysis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-make-the-code-work-in-rolling-window-analysis/m-p/238640#M268314</link>
      <description>&lt;P&gt;The following code is provided by&amp;nbsp;data_null__ for my prior question. the code works perfect when there do exist&amp;nbsp;empty datasets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I tried to apply it to rolling window regression.&amp;nbsp;some rolling windows' regressions generate empty tables, while other rolling windows' regressions do not generate empty tables. &amp;nbsp;The SAS program stop in the rolling window where there is no empty table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway to force the program to continue processing when there is no empty table? Thanks a lot!&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;proc sql noprint; 
   select memname into :zero separated by ' '
      from dictionary.tables 
      where libname eq 'WORK' and memname eqt 'HAVE_' and nobs eq 0; 
   quit; 
   run; 
%put NOTE: &amp;amp;=zero;
data &amp;amp;zero;
   do _n_ = 1 to 3; 
      output; 
      end; 
   stop; 
   set &amp;amp;zero;
   run; &lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2015 08:03:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-make-the-code-work-in-rolling-window-analysis/m-p/238640#M268314</guid>
      <dc:creator>Jonate_H</dc:creator>
      <dc:date>2015-12-10T08:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to make the code work in rolling window analysis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-make-the-code-work-in-rolling-window-analysis/m-p/238648#M268315</link>
      <description>&lt;P&gt;Do you mean the file does not exist at all? &amp;nbsp; If so then use the exist() function:&lt;/P&gt;
&lt;P&gt;data _null_;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; if %sysfunc(exist(&amp;lt;libname&amp;gt;.&amp;lt;dataset&amp;gt;))=0 then call execute('proc sql; create table &amp;lt;libname&amp;gt;.&amp;lt;dataset&amp;gt; (a num); quit;');&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The above will check if &amp;lt;libname&amp;gt;.&amp;lt;dataset&amp;gt; exists and if not create it with a variable a and no records. &amp;nbsp;Then it will exist for the =0 calculation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To be honest though, if your previous code is not generating what you want, then I would look at the process you are doing, and see if you can create logic which does work as intended - see my reply to your other post - there is no need to split things out or create lists, it can all be done in base SAS with varying structures. &amp;nbsp;Otherwise you end up creating other problems like this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2015 09:43:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-make-the-code-work-in-rolling-window-analysis/m-p/238648#M268315</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-12-10T09:43:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to make the code work in rolling window analysis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-make-the-code-work-in-rolling-window-analysis/m-p/238656#M268316</link>
      <description>&lt;P&gt;I believe all you need to do is assign ZERO=_NULL_ before calling PROC SQL. &amp;nbsp;PROC SQL does not create and INTO variable when "No rows were selected"; &amp;nbsp;Assignin _NULL_ will allow the data step to execute without error but do nothing.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;24        &lt;STRONG&gt; %let zero=_NULL_;&lt;/STRONG&gt;
25         proc sql noprint;
26            select memname into :zero separated by ' '
27               from dictionary.tables
28               where libname eq 'WORK' and memname eqt 'HAVE_' and nobs eq 0;
NOTE: No rows were selected.
29            quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.03 seconds
      cpu time            0.00 seconds
      

30            run;
31         %put NOTE: &amp;amp;=zero;
NOTE: ZERO=_NULL_
32         data &amp;amp;zero;
33            do _n_ = 1 to 3;
34               output;
35               end;
36            stop;
37            set &amp;amp;zero;
38            run;

NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Dec 2015 10:29:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-make-the-code-work-in-rolling-window-analysis/m-p/238656#M268316</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2015-12-10T10:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to make the code work in rolling window analysis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-make-the-code-work-in-rolling-window-analysis/m-p/238719#M268317</link>
      <description>&lt;P&gt;Thank you for your advice. since the original program is wrote&amp;nbsp;in that way, it will take a lot of effort to rewrit it. so I thought it would save my time to just "fixed" it. I agree with you that if I write a code from sketch I should start with&amp;nbsp;a "simple" way from every beginning.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2015 16:19:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-make-the-code-work-in-rolling-window-analysis/m-p/238719#M268317</guid>
      <dc:creator>Jonate_H</dc:creator>
      <dc:date>2015-12-10T16:19:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to make the code work in rolling window analysis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-make-the-code-work-in-rolling-window-analysis/m-p/238720#M268318</link>
      <description>&lt;P&gt;Thanks a lot!&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2015 16:20:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-make-the-code-work-in-rolling-window-analysis/m-p/238720#M268318</guid>
      <dc:creator>Jonate_H</dc:creator>
      <dc:date>2015-12-10T16:20:48Z</dc:date>
    </item>
  </channel>
</rss>

