<?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: do loop, how to keep missing observations in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/do-loop-how-to-keep-missing-observations/m-p/398919#M96550</link>
    <description>&lt;P&gt;Try adding one more statement at the end of the DATA step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;else output;&lt;/P&gt;</description>
    <pubDate>Tue, 26 Sep 2017 19:12:10 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2017-09-26T19:12:10Z</dc:date>
    <item>
      <title>do loop, how to keep missing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/do-loop-how-to-keep-missing-observations/m-p/398915#M96548</link>
      <description>&lt;P&gt;Hello everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using a do loop to create a counter variable, count. However, the values that needs to be counted is not fully complete. How can I adjust the following code to include missing observations? I want to add a line that makes count=. if time=., and have no rows added if time=., but i couldn't get an if-then statement to work. Instead, the rows where time=. are removed from the dataset.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data dat2; 
	set dat1; 
	if time ge 0 then do 
		count=1 to round(time, 1);
			output; 
			end;
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Sep 2017 19:05:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/do-loop-how-to-keep-missing-observations/m-p/398915#M96548</guid>
      <dc:creator>pamplemouse22</dc:creator>
      <dc:date>2017-09-26T19:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: do loop, how to keep missing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/do-loop-how-to-keep-missing-observations/m-p/398919#M96550</link>
      <description>&lt;P&gt;Try adding one more statement at the end of the DATA step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;else output;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 19:12:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/do-loop-how-to-keep-missing-observations/m-p/398919#M96550</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-09-26T19:12:10Z</dc:date>
    </item>
    <item>
      <title>Re: do loop, how to keep missing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/do-loop-how-to-keep-missing-observations/m-p/398920#M96551</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data dat2; 
	set dat1; 
if time=. then output;
	else if time ge 0 then do 
		count=1 to round(time, 1);
			output; 
			end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Sep 2017 19:12:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/do-loop-how-to-keep-missing-observations/m-p/398920#M96551</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2017-09-26T19:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: do loop, how to keep missing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/do-loop-how-to-keep-missing-observations/m-p/398921#M96552</link>
      <description>&lt;P&gt;That worked! Thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 19:13:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/do-loop-how-to-keep-missing-observations/m-p/398921#M96552</guid>
      <dc:creator>pamplemouse22</dc:creator>
      <dc:date>2017-09-26T19:13:18Z</dc:date>
    </item>
    <item>
      <title>Re: do loop, how to keep missing observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/do-loop-how-to-keep-missing-observations/m-p/398923#M96554</link>
      <description>&lt;P&gt;You could just make sure your upper bound is at least 1.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data dat2; 
  set dat1; 
  do count=1 to max(1,round(time, 1));
    output; 
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Sep 2017 19:16:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/do-loop-how-to-keep-missing-observations/m-p/398923#M96554</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-09-26T19:16:23Z</dc:date>
    </item>
  </channel>
</rss>

