<?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 calculated reference in PROC SQL in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/calculated-reference-in-PROC-SQL/m-p/521687#M141562</link>
    <description>&lt;P&gt;Calculated references work in the PROC SQL WHERE clause as below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
	create table task as
		select
			name,
			sex,
			age,
			age*10 as myVar
		from
			sashelp.class
		where	
			calculated myVar ge 150;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wonder why it does not work in an ON clause?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data romans;
	length roman $ 4;
	age='11';roman='XI';output;
	age='12';roman='XII';output;
	age='13';roman='XIII';output;
	age='14';roman='XIV';output;
	age='15';roman='XV';output;
	age='16';roman='XVI';output;
run;

proc sql noprint;
	create table task as
		select
			a.name,
			a.sex,
			a.age,
			strip(put(a.age,8.)) as myVar,
			b.roman
		from
			sashelp.class a
			inner join romans b
				on calculated myVar=b.age;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 15 Dec 2018 00:36:21 GMT</pubDate>
    <dc:creator>dataMart87</dc:creator>
    <dc:date>2018-12-15T00:36:21Z</dc:date>
    <item>
      <title>calculated reference in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculated-reference-in-PROC-SQL/m-p/521687#M141562</link>
      <description>&lt;P&gt;Calculated references work in the PROC SQL WHERE clause as below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
	create table task as
		select
			name,
			sex,
			age,
			age*10 as myVar
		from
			sashelp.class
		where	
			calculated myVar ge 150;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wonder why it does not work in an ON clause?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data romans;
	length roman $ 4;
	age='11';roman='XI';output;
	age='12';roman='XII';output;
	age='13';roman='XIII';output;
	age='14';roman='XIV';output;
	age='15';roman='XV';output;
	age='16';roman='XVI';output;
run;

proc sql noprint;
	create table task as
		select
			a.name,
			a.sex,
			a.age,
			strip(put(a.age,8.)) as myVar,
			b.roman
		from
			sashelp.class a
			inner join romans b
				on calculated myVar=b.age;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 15 Dec 2018 00:36:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculated-reference-in-PROC-SQL/m-p/521687#M141562</guid>
      <dc:creator>dataMart87</dc:creator>
      <dc:date>2018-12-15T00:36:21Z</dc:date>
    </item>
    <item>
      <title>Re: calculated reference in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculated-reference-in-PROC-SQL/m-p/521693#M141564</link>
      <description>&lt;P&gt;You are basically selecting columns from a table or from a combined/joined tables and not the other way round&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So note the correction as follows&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
	create table task as
		select
			a.name,
			a.sex,
			a.age,
			strip(put(a.age,8.)) as myVar,
			b.roman
		from
			sashelp.class a
			inner join romans b
				on put(a.age,8. -l)=b.age;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Dec 2018 01:28:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculated-reference-in-PROC-SQL/m-p/521693#M141564</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-12-15T01:28:00Z</dc:date>
    </item>
  </channel>
</rss>

