<?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: SAS sql, how to use a newly created variable within the same sql in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-sql-how-to-use-a-newly-created-variable-within-the-same-sql/m-p/534522#M146680</link>
    <description>&lt;P&gt;Thank you very much! it works.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Feb 2019 16:35:59 GMT</pubDate>
    <dc:creator>HappySASUE</dc:creator>
    <dc:date>2019-02-11T16:35:59Z</dc:date>
    <item>
      <title>SAS sql, how to use a newly created variable within the same sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-sql-how-to-use-a-newly-created-variable-within-the-same-sql/m-p/534470#M146659</link>
      <description>&lt;P&gt;This is a partial code of the one I am working on.&amp;nbsp; the purpose is to change "-0.0" or "-0" to "0".&amp;nbsp; I used "case" to create a new variable "New_min" and apply it to the next new variable "m".&amp;nbsp; but I failed, can anyone tell me how to do it ? Thanks.&amp;nbsp; The SAS version I am working on is 9.4.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;create table data2 as&lt;BR /&gt;select avisitn,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; case&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; when abs(var_min) le 0.0000001 or var_min = -0 then 0&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; when var_min = . then .&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else strip(put( var_min, 10.2 )) end as new_min,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;strip(put(round(new_min,0.01),best.))||', '|| strip(put(round(_max,0.01),best.)) end as m&lt;/P&gt;&lt;P&gt;from data1;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Feb 2019 14:28:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-sql-how-to-use-a-newly-created-variable-within-the-same-sql/m-p/534470#M146659</guid>
      <dc:creator>HappySASUE</dc:creator>
      <dc:date>2019-02-11T14:28:23Z</dc:date>
    </item>
    <item>
      <title>Re: SAS sql, how to use a newly created variable within the same sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-sql-how-to-use-a-newly-created-variable-within-the-same-sql/m-p/534472#M146660</link>
      <description>put 'calculated' in front of new_min:&lt;BR /&gt;&lt;BR /&gt;  strip(put(round(calculated new_min,0.01),best.))||', '|| strip(put(round(_max,0.01),best.)) end as m&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a002294533.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a002294533.htm&lt;/A&gt;</description>
      <pubDate>Mon, 11 Feb 2019 14:33:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-sql-how-to-use-a-newly-created-variable-within-the-same-sql/m-p/534472#M146660</guid>
      <dc:creator>tomrvincent</dc:creator>
      <dc:date>2019-02-11T14:33:30Z</dc:date>
    </item>
    <item>
      <title>Re: SAS sql, how to use a newly created variable within the same sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-sql-how-to-use-a-newly-created-variable-within-the-same-sql/m-p/534514#M146676</link>
      <description>&lt;P&gt;You could simplify to:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table data2 as
select 
    avisitn,
    catx(", ", put(fuzz(var_min), 10.2), put(_max, 10.2)) as m
from data1;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Feb 2019 16:16:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-sql-how-to-use-a-newly-created-variable-within-the-same-sql/m-p/534514#M146676</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-02-11T16:16:53Z</dc:date>
    </item>
    <item>
      <title>Re: SAS sql, how to use a newly created variable within the same sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-sql-how-to-use-a-newly-created-variable-within-the-same-sql/m-p/534522#M146680</link>
      <description>&lt;P&gt;Thank you very much! it works.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Feb 2019 16:35:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-sql-how-to-use-a-newly-created-variable-within-the-same-sql/m-p/534522#M146680</guid>
      <dc:creator>HappySASUE</dc:creator>
      <dc:date>2019-02-11T16:35:59Z</dc:date>
    </item>
    <item>
      <title>Re: SAS sql, how to use a newly created variable within the same sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-sql-how-to-use-a-newly-created-variable-within-the-same-sql/m-p/534527#M146681</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 11 Feb 2019 16:43:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-sql-how-to-use-a-newly-created-variable-within-the-same-sql/m-p/534527#M146681</guid>
      <dc:creator>HappySASUE</dc:creator>
      <dc:date>2019-02-11T16:43:13Z</dc:date>
    </item>
  </channel>
</rss>

