<?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 How to mark calculated observations as missing in proc sql in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-mark-calculated-observations-as-missing-in-proc-sql/m-p/720101#M223038</link>
    <description>&lt;P&gt;Hi SAS Users.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a code below to create the table work.industry_mtbv&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table work.industry_mtbv as
  select year, INDC3, 
		median(wMAR_TO_BOO) as median_mtbv
  from canus
  group by INDC3,year
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This means that median_mtbv will be calculated for each INDC3( industry) each year.&lt;/P&gt;
&lt;P&gt;I want to add one more condition that: if&amp;nbsp; INDC3 in ('NA', 'UNCLS', 'UQESQ') then median_mtbv=.&amp;nbsp; (setting missing for median_mtbv if INDC3 is one of these three industries)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please suggest to me how can I adjust the proc SQL above to add this condition?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Warmest regards.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Feb 2021 05:07:15 GMT</pubDate>
    <dc:creator>Phil_NZ</dc:creator>
    <dc:date>2021-02-18T05:07:15Z</dc:date>
    <item>
      <title>How to mark calculated observations as missing in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-mark-calculated-observations-as-missing-in-proc-sql/m-p/720101#M223038</link>
      <description>&lt;P&gt;Hi SAS Users.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a code below to create the table work.industry_mtbv&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table work.industry_mtbv as
  select year, INDC3, 
		median(wMAR_TO_BOO) as median_mtbv
  from canus
  group by INDC3,year
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This means that median_mtbv will be calculated for each INDC3( industry) each year.&lt;/P&gt;
&lt;P&gt;I want to add one more condition that: if&amp;nbsp; INDC3 in ('NA', 'UNCLS', 'UQESQ') then median_mtbv=.&amp;nbsp; (setting missing for median_mtbv if INDC3 is one of these three industries)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please suggest to me how can I adjust the proc SQL above to add this condition?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Warmest regards.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 05:07:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-mark-calculated-observations-as-missing-in-proc-sql/m-p/720101#M223038</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-02-18T05:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to mark calculated observations as missing in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-mark-calculated-observations-as-missing-in-proc-sql/m-p/720108#M223041</link>
      <description>&lt;P&gt;Maybe the CASE-statement could be used, but imho this makes sql even less readable.&lt;/P&gt;
&lt;P&gt;I would not use sql for anything, that could be solved by using a normal proc, so:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=canus nway;
  class indc3 year;
  var wMAR_TO_BOO;
  output out=work.industry_mtbv(drop= _type_ _freq_) median=median_mtbv;
run;

data work.industry_mtbv;
  set work.industry_mtbv;

  if indc3 in ('NA', 'UNCLS', 'UQESQ') then median_mtbv = .;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 05:41:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-mark-calculated-observations-as-missing-in-proc-sql/m-p/720108#M223041</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-02-18T05:41:55Z</dc:date>
    </item>
  </channel>
</rss>

