<?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: how to include an empty dataset in data part? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-include-an-empty-dataset-in-data-part/m-p/890810#M351995</link>
    <description>&lt;P&gt;When I look further, I found 1 var in datasets has been defined as both character and numeric. Is it a quick way to fix this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example: var `test1` should be a character var, but when it is all empty, ds_* put it as&amp;nbsp;numeric. How can I update&amp;nbsp; `test1` in all ds_* to&amp;nbsp;character?&lt;/P&gt;</description>
    <pubDate>Thu, 24 Aug 2023 15:39:14 GMT</pubDate>
    <dc:creator>stataq</dc:creator>
    <dc:date>2023-08-24T15:39:14Z</dc:date>
    <item>
      <title>how to include an empty dataset in data part?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-include-an-empty-dataset-in-data-part/m-p/890798#M351987</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to build new data `all`, with 10 ds: ds_1 to ds_10. however ds_5 is an empty dataset. what should I do?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;currently I have following codes but it wont give me the ds I want:&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;data all;&lt;/P&gt;&lt;P&gt;set ds_:;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it a&amp;nbsp; smart way to build all without picking out the empty ds_*?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2023 15:11:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-include-an-empty-dataset-in-data-part/m-p/890798#M351987</guid>
      <dc:creator>stataq</dc:creator>
      <dc:date>2023-08-24T15:11:11Z</dc:date>
    </item>
    <item>
      <title>Re: how to include an empty dataset in data part?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-include-an-empty-dataset-in-data-part/m-p/890804#M351992</link>
      <description>&lt;P&gt;An empty dataset, meaning 0 obs, should not be a problem.&amp;nbsp; Below test code runs fine:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ds_1 ds_2(where=(0)) ds_3 ;
  do i=1 to 5 ;
    output ;
  end ;
run ;

data all ;
  set ds_: ;
run ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Can you share a small example of your problem?&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2023 15:18:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-include-an-empty-dataset-in-data-part/m-p/890804#M351992</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-08-24T15:18:56Z</dc:date>
    </item>
    <item>
      <title>Re: how to include an empty dataset in data part?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-include-an-empty-dataset-in-data-part/m-p/890805#M351993</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/448857"&gt;@stataq&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to build new data `all`, with 10 ds: ds_1 to ds_10. however ds_5 is an empty dataset. what should I do?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;currently I have following codes but it wont give me the ds I want:&lt;/P&gt;
&lt;P&gt;```&lt;/P&gt;
&lt;P&gt;data all;&lt;/P&gt;
&lt;P&gt;set ds_:;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;```&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it a&amp;nbsp; smart way to build all without picking out the empty ds_*?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Explain what happens when you try this. Do you get an error? If so, show us the log. Do you get the wrong result? If so, explain what is wrong.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I try this, it works fine. No errors in the log. Expected output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Create fake data */
data ds_1 ds_2;
    set sashelp.class;
    if name='Jane' then output ds_1;
    else if name='Robert' then output ds_2;
run;
data ds_3;
    delete;
run;

data all;
    set ds_:;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2023 15:37:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-include-an-empty-dataset-in-data-part/m-p/890805#M351993</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-08-24T15:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: how to include an empty dataset in data part?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-include-an-empty-dataset-in-data-part/m-p/890809#M351994</link>
      <description>&lt;P&gt;Show us the LOG resulting from that code. &lt;/P&gt;
&lt;P&gt;Then describe what is not present that you want. Or what is present that you don't want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm afraid that "give me the ds I want" requires mindreading to know what you want which is notoriously unreliable over the internet.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2023 15:28:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-include-an-empty-dataset-in-data-part/m-p/890809#M351994</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-08-24T15:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: how to include an empty dataset in data part?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-include-an-empty-dataset-in-data-part/m-p/890810#M351995</link>
      <description>&lt;P&gt;When I look further, I found 1 var in datasets has been defined as both character and numeric. Is it a quick way to fix this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example: var `test1` should be a character var, but when it is all empty, ds_* put it as&amp;nbsp;numeric. How can I update&amp;nbsp; `test1` in all ds_* to&amp;nbsp;character?&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2023 15:39:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-include-an-empty-dataset-in-data-part/m-p/890810#M351995</guid>
      <dc:creator>stataq</dc:creator>
      <dc:date>2023-08-24T15:39:14Z</dc:date>
    </item>
    <item>
      <title>Re: how to include an empty dataset in data part?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-include-an-empty-dataset-in-data-part/m-p/890824#M351999</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/448857"&gt;@stataq&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;When I look further, I found 1 var in datasets has been defined as both character and numeric. Is it a quick way to fix this?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example: var `test1` should be a character var, but when it is all empty, ds_* put it as&amp;nbsp;numeric. How can I update&amp;nbsp; `test1` in all ds_* to&amp;nbsp;character?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You really have to fix the process that is creating your data sets, even your empty data sets&lt;/P&gt;
&lt;P&gt;Show the code that makes that empty data set.&lt;/P&gt;
&lt;P&gt;And may require going back multiple steps in your process.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The reason to fix the process is moderately simple. I could "fix" one data set for one variable pretty easily. Suppose the next time around you have 5 data sets with the same variable character and 5 with the variable numeric. Which should be which? Fixing 5 sets gets to be more work. And if you start having this issue with multiple variables the work increases exponentially.&amp;nbsp; Fix the process one time and you don't have to deal with it again.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course this begs the whole "empty dataset" question which is a similar kettle of fish.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2023 16:40:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-include-an-empty-dataset-in-data-part/m-p/890824#M351999</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-08-24T16:40:56Z</dc:date>
    </item>
    <item>
      <title>Re: how to include an empty dataset in data part?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-include-an-empty-dataset-in-data-part/m-p/890834#M352002</link>
      <description>&lt;P&gt;Agree with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;, there's isn't a quick fix for a variable type mismatch.&amp;nbsp; Best would be to go back and solve why empty datasets have variables with the wrong type.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you don't want to do that, messier hack would be to add a step to check all of your ds_* datasets and delete any of them that have 0 obs, before you use SET ds_: ; to concatenate them.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2023 17:13:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-include-an-empty-dataset-in-data-part/m-p/890834#M352002</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-08-24T17:13:40Z</dc:date>
    </item>
  </channel>
</rss>

