<?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: Filling empty cells with another column`s variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Filling-empty-cells-with-another-column-s-variable/m-p/717346#M221819</link>
    <description>&lt;P&gt;Surely you could give us some sample data .... what it looks like before and what you want it to look like.&amp;nbsp; Be sure to include one example where a CustomerID is missing its very first dateofpurchase.&lt;/P&gt;</description>
    <pubDate>Sun, 07 Feb 2021 02:33:50 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2021-02-07T02:33:50Z</dc:date>
    <item>
      <title>Filling empty cells with another column`s variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Filling-empty-cells-with-another-column-s-variable/m-p/717338#M221814</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi everyone, hoping to get some help on this one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table that holds customerIDs. There are two other columns called `dateofpurchase` and 'dateofvisit'. When 'dateofpurchase' is empty, im hoping to full these cells with the same 'dateofvisit' values, kind of like a default. However, if the 'dateofpurchase' is not empty, I want to keep it as is.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not have code to attach since I don't know where to start.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Sun, 07 Feb 2021 00:14:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Filling-empty-cells-with-another-column-s-variable/m-p/717338#M221814</guid>
      <dc:creator>JibJam221</dc:creator>
      <dc:date>2021-02-07T00:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: Filling empty cells with another column`s variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Filling-empty-cells-with-another-column-s-variable/m-p/717346#M221819</link>
      <description>&lt;P&gt;Surely you could give us some sample data .... what it looks like before and what you want it to look like.&amp;nbsp; Be sure to include one example where a CustomerID is missing its very first dateofpurchase.&lt;/P&gt;</description>
      <pubDate>Sun, 07 Feb 2021 02:33:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Filling-empty-cells-with-another-column-s-variable/m-p/717346#M221819</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-02-07T02:33:50Z</dc:date>
    </item>
    <item>
      <title>Re: Filling empty cells with another column`s variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Filling-empty-cells-with-another-column-s-variable/m-p/717350#M221821</link>
      <description>&lt;P&gt;One way&amp;nbsp; would look something like this:&lt;/P&gt;
&lt;PRE&gt;data want;
   set have;
   if missing(dateofpurchase) then dateofpurchase=dateofvisit;
run;&lt;/PRE&gt;
&lt;P&gt;The missing function tests a variable to see if it is missing and returns "true" (actually a numeric value of 1) when the variable does not have a value. If the variable is character consisting only of blanks it will also result in true.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Feb 2021 04:49:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Filling-empty-cells-with-another-column-s-variable/m-p/717350#M221821</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-02-07T04:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: Filling empty cells with another column`s variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Filling-empty-cells-with-another-column-s-variable/m-p/717461#M221882</link>
      <description>thank you for this! Question - do you know if there is a way to do this for character variables as well?</description>
      <pubDate>Sun, 07 Feb 2021 23:35:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Filling-empty-cells-with-another-column-s-variable/m-p/717461#M221882</guid>
      <dc:creator>JibJam221</dc:creator>
      <dc:date>2021-02-07T23:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: Filling empty cells with another column`s variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Filling-empty-cells-with-another-column-s-variable/m-p/717464#M221883</link>
      <description>&lt;P&gt;I think you can do&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want (rename(dateofpurchase1=dateofpurchase) drop=dateofpurchase1 );
   set have;
   dateofpurchase1= ifn(' ',dateofvisit,dateofpurchase)
run;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;And regarding the character value , you can change from "ifn" to "ifc" as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp; mentioned.&lt;/P&gt;
&lt;P&gt;More documents for you:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=n0l3n5z2h31h7wn1fmnqd33ibhap.htm&amp;amp;locale=en"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=n0l3n5z2h31h7wn1fmnqd33ibhap.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=p07za51a2k0sxkn1m0tulx2cy464.htm&amp;amp;locale=en"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=p07za51a2k0sxkn1m0tulx2cy464.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 18:36:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Filling-empty-cells-with-another-column-s-variable/m-p/717464#M221883</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-02-08T18:36:17Z</dc:date>
    </item>
    <item>
      <title>Re: Filling empty cells with another column`s variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Filling-empty-cells-with-another-column-s-variable/m-p/717507#M221905</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/207689"&gt;@JibJam221&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;thank you for this! Question - do you know if there is a way to do this for character variables as well?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The code posted by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt; works idependent of the variables' type. Both variables used in the assignment must have, of course, the same type.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 07:50:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Filling-empty-cells-with-another-column-s-variable/m-p/717507#M221905</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-02-08T07:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: Filling empty cells with another column`s variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Filling-empty-cells-with-another-column-s-variable/m-p/717588#M221940</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212695"&gt;@Phil_NZ&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I think you can do&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want (rename(dateofpurchase1=dateofpurchase) drop=dateofpurchase1 );
   set have;
   dateofpurchase1= ifn(' ',dateofvisit,dateofpurchase)
run;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;And I think it can be applied for both numeric and character types of var.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Actually IFN works with numeric values. Character values require IFC.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 15:18:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Filling-empty-cells-with-another-column-s-variable/m-p/717588#M221940</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-02-08T15:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: Filling empty cells with another column`s variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Filling-empty-cells-with-another-column-s-variable/m-p/717631#M221951</link>
      <description>it works! Thank you x a million!</description>
      <pubDate>Mon, 08 Feb 2021 16:21:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Filling-empty-cells-with-another-column-s-variable/m-p/717631#M221951</guid>
      <dc:creator>JibJam221</dc:creator>
      <dc:date>2021-02-08T16:21:39Z</dc:date>
    </item>
    <item>
      <title>Re: Filling empty cells with another column`s variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Filling-empty-cells-with-another-column-s-variable/m-p/717632#M221952</link>
      <description>thank you!</description>
      <pubDate>Mon, 08 Feb 2021 16:22:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Filling-empty-cells-with-another-column-s-variable/m-p/717632#M221952</guid>
      <dc:creator>JibJam221</dc:creator>
      <dc:date>2021-02-08T16:22:28Z</dc:date>
    </item>
  </channel>
</rss>

