<?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 No results still populate a field? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/No-results-still-populate-a-field/m-p/41872#M10850</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you may need a couple of steps:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like this should work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt; create table work.test &lt;/P&gt;&lt;P&gt;(query_for_test1 char(10),... etc..&lt;/P&gt;&lt;P&gt; rundate NUM&amp;nbsp; format=datetime16.);&lt;/P&gt;&lt;P&gt;insert into work.test&lt;/P&gt;&lt;P&gt;(rundate)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; values(%sysfunc(datetime()));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; insert into work.test&lt;/P&gt;&lt;P&gt;from work.query_for_test1.... etc. (real data)&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 24 Mar 2012 12:18:56 GMT</pubDate>
    <dc:creator>jcbell</dc:creator>
    <dc:date>2012-03-24T12:18:56Z</dc:date>
    <item>
      <title>No results still populate a field?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/No-results-still-populate-a-field/m-p/41871#M10849</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;﻿﻿I need the RunDate field to populate when the report was run, even if there are no results in order to show that it was run for each day. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;﻿proc sql; &lt;/P&gt;&lt;P&gt;create table work.test as select distinct query_for_test1&lt;/P&gt;&lt;P&gt;query_for_test1.field1&lt;/P&gt;&lt;P&gt;query_for_test1.field2&lt;/P&gt;&lt;P&gt;(datetime()) formate=datetime16.0 as RunDate&lt;/P&gt;&lt;P&gt;from work.query_for_test1 as query_for_test1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Mar 2012 17:58:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/No-results-still-populate-a-field/m-p/41871#M10849</guid>
      <dc:creator>mmswan</dc:creator>
      <dc:date>2012-03-23T17:58:44Z</dc:date>
    </item>
    <item>
      <title>No results still populate a field?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/No-results-still-populate-a-field/m-p/41872#M10850</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you may need a couple of steps:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like this should work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt; create table work.test &lt;/P&gt;&lt;P&gt;(query_for_test1 char(10),... etc..&lt;/P&gt;&lt;P&gt; rundate NUM&amp;nbsp; format=datetime16.);&lt;/P&gt;&lt;P&gt;insert into work.test&lt;/P&gt;&lt;P&gt;(rundate)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; values(%sysfunc(datetime()));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; insert into work.test&lt;/P&gt;&lt;P&gt;from work.query_for_test1.... etc. (real data)&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Mar 2012 12:18:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/No-results-still-populate-a-field/m-p/41872#M10850</guid>
      <dc:creator>jcbell</dc:creator>
      <dc:date>2012-03-24T12:18:56Z</dc:date>
    </item>
    <item>
      <title>Re: No results still populate a field?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/No-results-still-populate-a-field/m-p/41873#M10851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Using a left join does the trick. A single observation table is created containing the current time. Then it is left-joined with the result from your query (the join condition &lt;STRONG&gt;on 1&lt;/STRONG&gt; always matches). If your query returns empty then a single observation is created with the current time, all other fields are missing. Try the folowing code by changing the query condition from &lt;STRONG&gt;i &amp;gt; 12&lt;/STRONG&gt; to &lt;STRONG&gt;i &amp;lt; 5&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;data test;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;do i = 1 to 10; output; end; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;proc sql;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;create table rundate (rundate date format=datetime20.0);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;insert into rundate set rundate=datetime();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;create table qry as&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;select A.rundate, B.i from&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;rundate as A left join (select i from test where i &amp;gt; 12) as B on 1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;drop table rundate;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Mar 2012 20:35:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/No-results-still-populate-a-field/m-p/41873#M10851</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2012-03-24T20:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: No results still populate a field?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/No-results-still-populate-a-field/m-p/41874#M10852</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need comma to split these columns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;proc sql;
 create table x as
&amp;nbsp; select name,sex,age,datetime() format=datetime. as runtime
&amp;nbsp;&amp;nbsp; from sashelp.class;
quit;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Mar 2012 04:12:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/No-results-still-populate-a-field/m-p/41874#M10852</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-03-26T04:12:54Z</dc:date>
    </item>
  </channel>
</rss>

