<?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: Fill Missing Values in table in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Fill-Missing-Values-in-table/m-p/606912#M76605</link>
    <description>&lt;P&gt;Hello, Thank you for replying promptly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would the query be something like this? Again apologize as I am still having a tough time figuring this out.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data work.apacstore;&lt;BR /&gt;if missing(ProductName) then ProductName = CATX(' ', category, subcategory);&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kumar.&lt;/P&gt;</description>
    <pubDate>Mon, 25 Nov 2019 10:13:42 GMT</pubDate>
    <dc:creator>Kumarathevan</dc:creator>
    <dc:date>2019-11-25T10:13:42Z</dc:date>
    <item>
      <title>Fill Missing Values in table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Fill-Missing-Values-in-table/m-p/606897#M76603</link>
      <description>&lt;P&gt;Hello All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am a total beginner to SAS and was hoping someone could help me with one a replace missing data issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table as below where I have filtered to only display Product Name with Missing values which is blank. I am trying to find a method to replace those missing values in this table to be filled with a combination of the Category and Sub-Category.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example Row 1 Product name will be &lt;STRONG&gt;Technology Copiers&lt;/STRONG&gt;. Below is the code i used to filter this table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MissingData.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/34212i0CC1343EF1DB2036/image-size/large?v=v2&amp;amp;px=999" role="button" title="MissingData.png" alt="MissingData.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE WORK.QUERY2&lt;BR /&gt;AS&lt;BR /&gt;SELECT APACSALESDATA.Category, APACSALESDATA.'Sub-Category'n, APACSALESDATA.'Product Name'n&lt;BR /&gt;FROM WORK.APACSALESDATA APACSALESDATA&lt;BR /&gt;WHERE&lt;BR /&gt;(&lt;BR /&gt;(&lt;BR /&gt;( APACSALESDATA.Category = '' ) OR&lt;BR /&gt;( APACSALESDATA.'Sub-Category'n = '' )&lt;BR /&gt;) OR APACSALESDATA.'Product Name'n IS MISSING&lt;BR /&gt;) ;&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried the recode method, however I am not getting any results.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate any help on this subject.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2019 09:08:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Fill-Missing-Values-in-table/m-p/606897#M76603</guid>
      <dc:creator>Kumarathevan</dc:creator>
      <dc:date>2019-11-25T09:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: Fill Missing Values in table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Fill-Missing-Values-in-table/m-p/606908#M76604</link>
      <description>&lt;P&gt;Why not just use a DATA step with the CATX function?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if missing(prodname) then prodname = CATX(' ', category, subcategory);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Nov 2019 09:33:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Fill-Missing-Values-in-table/m-p/606908#M76604</guid>
      <dc:creator>jvdl</dc:creator>
      <dc:date>2019-11-25T09:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: Fill Missing Values in table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Fill-Missing-Values-in-table/m-p/606912#M76605</link>
      <description>&lt;P&gt;Hello, Thank you for replying promptly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would the query be something like this? Again apologize as I am still having a tough time figuring this out.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data work.apacstore;&lt;BR /&gt;if missing(ProductName) then ProductName = CATX(' ', category, subcategory);&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kumar.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2019 10:13:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Fill-Missing-Values-in-table/m-p/606912#M76605</guid>
      <dc:creator>Kumarathevan</dc:creator>
      <dc:date>2019-11-25T10:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: Fill Missing Values in table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Fill-Missing-Values-in-table/m-p/606915#M76606</link>
      <description>&lt;P&gt;you can do it proc sql as well like below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql,
create table want as select category,subcategory, 
case when productname='' then catx(' ',category,subcategory), else productname end as productname from have;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Nov 2019 10:26:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Fill-Missing-Values-in-table/m-p/606915#M76606</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-11-25T10:26:58Z</dc:date>
    </item>
    <item>
      <title>Re: Fill Missing Values in table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Fill-Missing-Values-in-table/m-p/606919#M76607</link>
      <description>&lt;P&gt;If you want to use a data step then you could use:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* set up data */
data have;
   set sashelp.class;

   /* set all names that begin with 'J' to missing */
   if name eq: 'J' then
      call missing(name);
run;

/* create a separate data set replace missing names, using a data step */
data want;
   set have;

   /* if name is missing then conjoin sex and age */
   if missing(name) then
      name = catx(' ',sex,age);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want to use SQL then you could use:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* set up data */
data have2;
   set sashelp.class;

   /* set all names that begin with 'J' to missing */
   if name eq: 'J' then
      call missing(name);
run;

/* replace missing names in original data set, using sql */
proc sql noprint;
   update
      have2
   set
      name = catx(' ',sex,age)
   where
      name is missing
   ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Amir.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2019 10:41:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Fill-Missing-Values-in-table/m-p/606919#M76607</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2019-11-25T10:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: Fill Missing Values in table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Fill-Missing-Values-in-table/m-p/606961#M76609</link>
      <description>&lt;P&gt;You can use the coalesce function to fill in missing values, e.g.:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as select
  Category,
  'Sub-Category'n,
  coalesce('Product Name'n,catx(' ',Category,'Sub-Category'n)) as 'Product Name'n
from have; 
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or you can update your table in place, if that is more appropriate:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  update have
  set 'Product Name'n=catx(' ',Category,'Sub-Category'n))
  where 'Product Name'n is null;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Nov 2019 13:50:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Fill-Missing-Values-in-table/m-p/606961#M76609</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2019-11-25T13:50:12Z</dc:date>
    </item>
    <item>
      <title>Re: Fill Missing Values in table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Fill-Missing-Values-in-table/m-p/607005#M76611</link>
      <description>&lt;P&gt;Yes, that should work.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2019 15:33:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Fill-Missing-Values-in-table/m-p/607005#M76611</guid>
      <dc:creator>jvdl</dc:creator>
      <dc:date>2019-11-25T15:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: Fill Missing Values in table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Fill-Missing-Values-in-table/m-p/607182#M76614</link>
      <description>&lt;P&gt;Thank you very much. This worked for me. really appreciate it!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 03:14:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Fill-Missing-Values-in-table/m-p/607182#M76614</guid>
      <dc:creator>Kumarathevan</dc:creator>
      <dc:date>2019-11-26T03:14:47Z</dc:date>
    </item>
    <item>
      <title>Re: Fill Missing Values in table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Fill-Missing-Values-in-table/m-p/607183#M76615</link>
      <description>Thank you very much. I tried the method suggested by Amir and it worked well for my query!</description>
      <pubDate>Tue, 26 Nov 2019 03:15:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Fill-Missing-Values-in-table/m-p/607183#M76615</guid>
      <dc:creator>Kumarathevan</dc:creator>
      <dc:date>2019-11-26T03:15:36Z</dc:date>
    </item>
  </channel>
</rss>

