<?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 ERROR my new variable is not found in table in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/ERROR-my-new-variable-is-not-found-in-table/m-p/587326#M34610</link>
    <description>&lt;P&gt;Hi this is my first time posting. I am trying to create a new variable defining fiscal year and then creating an excel export based off of that variable. This is my code. The error message I keep received is:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: The following columns were not found in the contributing tables: purch_fy.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname home "/Forest/SAS Data";
libname cba4a "/CBA/staging";


%macro extract7a(date_input);

%let lst12mn = %eval(&amp;amp;date_input. - 1);

data ext_7a_&amp;amp;date_input.;
	set cba4a.abcde21_&amp;amp;date_input.07 (keep = apfy	
						asofdate
						apprv_dt
						purch_cnt
						purch_dt
						purch_amtgrs
						lst12mnpurch_amtgrs
						lst12mnchoff_amtgrs
						purch_amtsba
						purch_balgrs
						purch_balsba
						purch_cnt
						purchases_amt
						purchases_amt_cum
						chargeoffpringrs
						choff_balgrs
						choff_cnt
						choff_dt
												);

data ext_7a2_&amp;amp;date_input.;
	set ext_7a_&amp;amp;date_input.;
	if purch_dt &amp;lt; '01OCT2014'd then delete;
	if missing(purch_dt) then delete;
	length purch_fy $4;
	if '01OCT2018'd &amp;lt; purch_dt &amp;lt;= '30JUN2019'd then purch_fy = "2019";
	else if '01OCT2017'd &amp;lt; purch_dt &amp;lt;= '30SEP2018'd then purch_fy = "2018";
	else if '01OCT2016'd &amp;lt; purch_dt &amp;lt;= '30SEP2017'd then purch_fy = "2017";
	else if '01OCT2015'd &amp;lt; purch_dt &amp;lt;= '30SEP2016'd then purch_fy = "2016";
	else if '01OCT2014'd &amp;lt; purch_dt &amp;lt;= '30SEP2015'd then purch_fy = "2015";
run;

proc sql;
	create table home.portfoliochoffpurch&amp;amp;date_input. as select
	purch_fy,
	sum(purch_cnt) as countpurch,
	sum(choff_cnt) as countchoff,
	sum(lst12mnpurch_amtgrs) as purchamt,
	sum(lst12mnchoff_amtgrs) as choffamt
	from ext_7a_&amp;amp;date_input.
	group by purch_fy;
quit;


%mend;

%extract7a(2019);


data home.portfolio_7aPC;
	set	home.portfoliochoffpurch2019;
run;

proc export data=home.portfolio_7aPC outfile = "/Forest/Excel Output/portfolio_7aPC.xlsx"
	dbms = xlsx replace;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 09 Sep 2019 18:16:12 GMT</pubDate>
    <dc:creator>claforest1</dc:creator>
    <dc:date>2019-09-09T18:16:12Z</dc:date>
    <item>
      <title>ERROR my new variable is not found in table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/ERROR-my-new-variable-is-not-found-in-table/m-p/587326#M34610</link>
      <description>&lt;P&gt;Hi this is my first time posting. I am trying to create a new variable defining fiscal year and then creating an excel export based off of that variable. This is my code. The error message I keep received is:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: The following columns were not found in the contributing tables: purch_fy.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname home "/Forest/SAS Data";
libname cba4a "/CBA/staging";


%macro extract7a(date_input);

%let lst12mn = %eval(&amp;amp;date_input. - 1);

data ext_7a_&amp;amp;date_input.;
	set cba4a.abcde21_&amp;amp;date_input.07 (keep = apfy	
						asofdate
						apprv_dt
						purch_cnt
						purch_dt
						purch_amtgrs
						lst12mnpurch_amtgrs
						lst12mnchoff_amtgrs
						purch_amtsba
						purch_balgrs
						purch_balsba
						purch_cnt
						purchases_amt
						purchases_amt_cum
						chargeoffpringrs
						choff_balgrs
						choff_cnt
						choff_dt
												);

data ext_7a2_&amp;amp;date_input.;
	set ext_7a_&amp;amp;date_input.;
	if purch_dt &amp;lt; '01OCT2014'd then delete;
	if missing(purch_dt) then delete;
	length purch_fy $4;
	if '01OCT2018'd &amp;lt; purch_dt &amp;lt;= '30JUN2019'd then purch_fy = "2019";
	else if '01OCT2017'd &amp;lt; purch_dt &amp;lt;= '30SEP2018'd then purch_fy = "2018";
	else if '01OCT2016'd &amp;lt; purch_dt &amp;lt;= '30SEP2017'd then purch_fy = "2017";
	else if '01OCT2015'd &amp;lt; purch_dt &amp;lt;= '30SEP2016'd then purch_fy = "2016";
	else if '01OCT2014'd &amp;lt; purch_dt &amp;lt;= '30SEP2015'd then purch_fy = "2015";
run;

proc sql;
	create table home.portfoliochoffpurch&amp;amp;date_input. as select
	purch_fy,
	sum(purch_cnt) as countpurch,
	sum(choff_cnt) as countchoff,
	sum(lst12mnpurch_amtgrs) as purchamt,
	sum(lst12mnchoff_amtgrs) as choffamt
	from ext_7a_&amp;amp;date_input.
	group by purch_fy;
quit;


%mend;

%extract7a(2019);


data home.portfolio_7aPC;
	set	home.portfoliochoffpurch2019;
run;

proc export data=home.portfolio_7aPC outfile = "/Forest/Excel Output/portfolio_7aPC.xlsx"
	dbms = xlsx replace;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Sep 2019 18:16:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/ERROR-my-new-variable-is-not-found-in-table/m-p/587326#M34610</guid>
      <dc:creator>claforest1</dc:creator>
      <dc:date>2019-09-09T18:16:12Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR my new variable is not found in table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/ERROR-my-new-variable-is-not-found-in-table/m-p/587327#M34611</link>
      <description>&lt;P&gt;You're referencing your original data set, not the created one. From should reference&amp;nbsp;&lt;FONT size="3" color="#000000"&gt;ext_7a&lt;FONT color="#FF0000"&gt;2&lt;/FONT&gt;_&amp;amp;date_input.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql;
	create table home.portfoliochoffpurch&amp;amp;date_input. as select
	purch_fy,
	sum(purch_cnt) as countpurch,
	sum(choff_cnt) as countchoff,
	sum(lst12mnpurch_amtgrs) as purchamt,
	sum(lst12mnchoff_amtgrs) as choffamt
&lt;FONT size="5" color="#FF0000"&gt;	&lt;STRONG&gt;from ext_7a_&amp;amp;date_input.&lt;/STRONG&gt;&lt;/FONT&gt;
	group by purch_fy;
quit;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/287699"&gt;@claforest1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi this is my first time posting. I am trying to create a new variable defining fiscal year and then creating an excel export based off of that variable. This is my code. The error message I keep received is:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR: The following columns were not found in the contributing tables: purch_fy.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname home "/Forest/SAS Data";
libname cba4a "/CBA/staging";


%macro extract7a(date_input);

%let lst12mn = %eval(&amp;amp;date_input. - 1);

data ext_7a_&amp;amp;date_input.;
	set cba4a.abcde21_&amp;amp;date_input.07 (keep = apfy	
						asofdate
						apprv_dt
						purch_cnt
						purch_dt
						purch_amtgrs
						lst12mnpurch_amtgrs
						lst12mnchoff_amtgrs
						purch_amtsba
						purch_balgrs
						purch_balsba
						purch_cnt
						purchases_amt
						purchases_amt_cum
						chargeoffpringrs
						choff_balgrs
						choff_cnt
						choff_dt
												);

data ext_7a2_&amp;amp;date_input.;
	set ext_7a_&amp;amp;date_input.;
	if purch_dt &amp;lt; '01OCT2014'd then delete;
	if missing(purch_dt) then delete;
	length purch_fy $4;
	if '01OCT2018'd &amp;lt; purch_dt &amp;lt;= '30JUN2019'd then purch_fy = "2019";
	else if '01OCT2017'd &amp;lt; purch_dt &amp;lt;= '30SEP2018'd then purch_fy = "2018";
	else if '01OCT2016'd &amp;lt; purch_dt &amp;lt;= '30SEP2017'd then purch_fy = "2017";
	else if '01OCT2015'd &amp;lt; purch_dt &amp;lt;= '30SEP2016'd then purch_fy = "2016";
	else if '01OCT2014'd &amp;lt; purch_dt &amp;lt;= '30SEP2015'd then purch_fy = "2015";
run;

proc sql;
	create table home.portfoliochoffpurch&amp;amp;date_input. as select
	purch_fy,
	sum(purch_cnt) as countpurch,
	sum(choff_cnt) as countchoff,
	sum(lst12mnpurch_amtgrs) as purchamt,
	sum(lst12mnchoff_amtgrs) as choffamt
	from ext_7a_&amp;amp;date_input.
	group by purch_fy;
quit;


%mend;

%extract7a(2019);


data home.portfolio_7aPC;
	set	home.portfoliochoffpurch2019;
run;

proc export data=home.portfolio_7aPC outfile = "/Forest/Excel Output/portfolio_7aPC.xlsx"
	dbms = xlsx replace;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;/LI-SPOILER&gt;</description>
      <pubDate>Mon, 09 Sep 2019 18:18:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/ERROR-my-new-variable-is-not-found-in-table/m-p/587327#M34611</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-09-09T18:18:41Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR my new variable is not found in table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/ERROR-my-new-variable-is-not-found-in-table/m-p/587330#M34612</link>
      <description>&lt;P&gt;One problem with making some many extra copies of the same data is remember what names you have given the different versions.&lt;/P&gt;
&lt;P&gt;Your SQL step is reading the dataset that was used to create the dataset that has the new variable. Instead of reading the dataset that actually has the new variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data ext_7a&lt;FONT color="#FF0000"&gt;2&lt;/FONT&gt;_&amp;amp;date_input.;&lt;BR /&gt;&amp;nbsp; set ext_7a_&amp;amp;date_input.;&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;from ext_7a_&amp;amp;date_input.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2019 18:21:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/ERROR-my-new-variable-is-not-found-in-table/m-p/587330#M34612</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-09-09T18:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR my new variable is not found in table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/ERROR-my-new-variable-is-not-found-in-table/m-p/587331#M34613</link>
      <description>&lt;P&gt;Thank you! I was about ready to throw my computer out the window. What a simple thing to forget...&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2019 18:22:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/ERROR-my-new-variable-is-not-found-in-table/m-p/587331#M34613</guid>
      <dc:creator>claforest1</dc:creator>
      <dc:date>2019-09-09T18:22:23Z</dc:date>
    </item>
  </channel>
</rss>

