title: How to create a case when query to return a result in a table
body: <p>I have a problem because I have two tables which are joined by country code and return tables with distinct keys. The problem is that I have blanks because these items do not have a country code added, but they have a currency that I would like to use to add items. For example, When &quot;WALUTA&quot; = 'PLN' THEN 'A.CODE =' PL 'but it doesn't work. Is there any other solution?</p>
  <pre><code>proc sql;
      create table COREP_CR as
      select distinct 
      a.DATA_DANYCH as REPORTING_DATE,
      a.CRD_CCF, 
      b.Kod,
      a.EXP_PIERWOTNA as  EAD_PRE_CCF,
      a.ID,
      a.TYPE_ASSET,
      a.Currency,
  
                  when (TYPE_ASSET) 'Futures' and (Currency) = 'PLN' then a.KOD = 'PLN'
                  end,
  
  I got &gt;ERROR 76-322: Syntax error, statement will be ignored.
  &gt;
              from corep as a
  left join _work.country_corep as b on a.Kraj=b.Kraj
  Group by b.Kod, a.TYPE_ASSET, a.CRD_CCF, ORIGINAL_ASSET_CLASS, FINAL_ASSET_CLASS, PRODUCT_TYPE
  ;
              QUIT;
  
  </code></pre>
  <p>After helped i got like this new colum _TEMP but i would like put this result to columdn Kod.</p>
  <p><a href="https://i.stack.imgur.com/tWhzi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tWhzi.png" alt="enter image description here" /></a></p>