<?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: Can we create new variable based on existing column using Proc SQL ? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Can-we-create-new-variable-based-on-existing-column-using-Proc/m-p/760302#M240408</link>
    <description>&lt;P&gt;You can use a SQL CASE expression:&amp;nbsp;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/sqlproc/n0a85s0ijz65irn1h3jtariooea5.htm" target="_blank"&gt;https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/sqlproc/n0a85s0ijz65irn1h3jtariooea5.htm&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively create a SAS format and use this format in your SQL to create the new variable. ...or don't even create the variable and just apply the format permanently to variable test.&lt;/P&gt;</description>
    <pubDate>Mon, 09 Aug 2021 02:39:09 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2021-08-09T02:39:09Z</dc:date>
    <item>
      <title>Can we create new variable based on existing column using Proc SQL ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-we-create-new-variable-based-on-existing-column-using-Proc/m-p/760301#M240407</link>
      <description>&lt;P&gt;I would like to create new field called &lt;STRONG&gt;Threshold&lt;/STRONG&gt; based on the existing &lt;STRONG&gt;Test&lt;/STRONG&gt; field. Is it possible to combine 2 code below with out an additional data step?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if test ="NP" then Threshold="&amp;gt; 14.80 = POS"&lt;BR /&gt;else if test="RB" then Threshold="&amp;gt; 14.64 = POS"&lt;BR /&gt;else if test="SP" then Threshold="&amp;gt; 19.66 = POS"&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;create table sample_final as&lt;BR /&gt;select sample, &lt;STRONG&gt;test&lt;/STRONG&gt;, conc_calculated format=7.2, count(N) as Total_counts, &lt;BR /&gt;"" as Threshold,&lt;BR /&gt;from sample_calcs&lt;BR /&gt;group by sample, &lt;STRONG&gt;test&lt;/STRONG&gt;, conc_calculated, Total_counts ;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 09 Aug 2021 02:36:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-we-create-new-variable-based-on-existing-column-using-Proc/m-p/760301#M240407</guid>
      <dc:creator>Stalk</dc:creator>
      <dc:date>2021-08-09T02:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: Can we create new variable based on existing column using Proc SQL ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-we-create-new-variable-based-on-existing-column-using-Proc/m-p/760302#M240408</link>
      <description>&lt;P&gt;You can use a SQL CASE expression:&amp;nbsp;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/sqlproc/n0a85s0ijz65irn1h3jtariooea5.htm" target="_blank"&gt;https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/sqlproc/n0a85s0ijz65irn1h3jtariooea5.htm&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively create a SAS format and use this format in your SQL to create the new variable. ...or don't even create the variable and just apply the format permanently to variable test.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Aug 2021 02:39:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-we-create-new-variable-based-on-existing-column-using-Proc/m-p/760302#M240408</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-08-09T02:39:09Z</dc:date>
    </item>
  </channel>
</rss>

