<?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 Variable is not on file error, even though Proc Contents shows variable in dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Variable-is-not-on-file-error-even-though-Proc-Contents-shows/m-p/591597#M169498</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi All. I'm trying to run the code below and getting an error saying&amp;nbsp;ERROR: Variable srcLOB is not on file HCGOUT.OUTCLAIMS_xxxx.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't know why this would be the cases, because I've checked using Proc Contents and the variable does exist. Any idea why this is happening?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;libname hcgout "/sasapps/HCG/HCG_PROD/Data_Sets/Output_NET";
%let list = linenum memberid memberctg incurd_yr_mo hcpcs;
%let hcpc = "E0431" "E1390" "E1392" "K0738";
%let loblist = "MCAD" "MCHM";


data hcgTables2014toPresent ;
	set hcgout.outclaims_2014 	 (where= (hcpcs in (&amp;amp;hcpc.) and srcLOB in (&amp;amp;loblist.)) keep=&amp;amp;list. rename=(incurd_yr_mo = date))
		hcgout.outclaims_2015 	 (where= (hcpcs in (&amp;amp;hcpc.) and srcLOB in (&amp;amp;loblist.)) keep=&amp;amp;list. rename=(incurd_yr_mo = date))
		hcgout.outclaims_prior 	 (where= (hcpcs in (&amp;amp;hcpc.) and srcLOB in (&amp;amp;loblist.)) keep=&amp;amp;list. rename=(incurd_yr_mo = date))		
		hcgout.outclaims_current (where= (hcpcs in (&amp;amp;hcpc.) and srcLOB in (&amp;amp;loblist.)) keep=&amp;amp;list. rename=(incurd_yr_mo = date));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 25 Sep 2019 15:52:24 GMT</pubDate>
    <dc:creator>acemanhattan</dc:creator>
    <dc:date>2019-09-25T15:52:24Z</dc:date>
    <item>
      <title>Variable is not on file error, even though Proc Contents shows variable in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-is-not-on-file-error-even-though-Proc-Contents-shows/m-p/591597#M169498</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi All. I'm trying to run the code below and getting an error saying&amp;nbsp;ERROR: Variable srcLOB is not on file HCGOUT.OUTCLAIMS_xxxx.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't know why this would be the cases, because I've checked using Proc Contents and the variable does exist. Any idea why this is happening?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;libname hcgout "/sasapps/HCG/HCG_PROD/Data_Sets/Output_NET";
%let list = linenum memberid memberctg incurd_yr_mo hcpcs;
%let hcpc = "E0431" "E1390" "E1392" "K0738";
%let loblist = "MCAD" "MCHM";


data hcgTables2014toPresent ;
	set hcgout.outclaims_2014 	 (where= (hcpcs in (&amp;amp;hcpc.) and srcLOB in (&amp;amp;loblist.)) keep=&amp;amp;list. rename=(incurd_yr_mo = date))
		hcgout.outclaims_2015 	 (where= (hcpcs in (&amp;amp;hcpc.) and srcLOB in (&amp;amp;loblist.)) keep=&amp;amp;list. rename=(incurd_yr_mo = date))
		hcgout.outclaims_prior 	 (where= (hcpcs in (&amp;amp;hcpc.) and srcLOB in (&amp;amp;loblist.)) keep=&amp;amp;list. rename=(incurd_yr_mo = date))		
		hcgout.outclaims_current (where= (hcpcs in (&amp;amp;hcpc.) and srcLOB in (&amp;amp;loblist.)) keep=&amp;amp;list. rename=(incurd_yr_mo = date));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2019 15:52:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-is-not-on-file-error-even-though-Proc-Contents-shows/m-p/591597#M169498</guid>
      <dc:creator>acemanhattan</dc:creator>
      <dc:date>2019-09-25T15:52:24Z</dc:date>
    </item>
    <item>
      <title>Re: Variable is not on file error, even though Proc Contents shows variable in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-is-not-on-file-error-even-though-Proc-Contents-shows/m-p/591599#M169499</link>
      <description>It's not in your KEEP list though so you're not bringing it in, even if it is in your original data set. &lt;BR /&gt;&lt;BR /&gt;I think your parenthesis are incorrect as well for your SET - it ends too early with the extra ) after the srcLOB?</description>
      <pubDate>Wed, 25 Sep 2019 15:58:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-is-not-on-file-error-even-though-Proc-Contents-shows/m-p/591599#M169499</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-09-25T15:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: Variable is not on file error, even though Proc Contents shows variable in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-is-not-on-file-error-even-though-Proc-Contents-shows/m-p/591602#M169501</link>
      <description>&lt;P&gt;Make it a point to always write dataset options in this order:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;keep/drop&lt;/LI&gt;
&lt;LI&gt;rename&lt;/LI&gt;
&lt;LI&gt;where&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;because that is the sequence in which they are applied by SAS, irrespective of the order in which you write them. That helps to make the code easier to understand and maintain.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2019 16:12:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-is-not-on-file-error-even-though-Proc-Contents-shows/m-p/591602#M169501</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-09-25T16:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: Variable is not on file error, even though Proc Contents shows variable in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-is-not-on-file-error-even-though-Proc-Contents-shows/m-p/591604#M169503</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Make it a point to always write dataset options in this order:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;keep/drop&lt;/LI&gt;
&lt;LI&gt;rename&lt;/LI&gt;
&lt;LI&gt;where&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;because that is the sequence in which they are applied by SAS, irrespective of the order in which you write them. That helps to make the code easier to understand and maintain.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Note you can remember the order easily because it is alphabetical. Drop,Keep,Rename,Where.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2019 16:14:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-is-not-on-file-error-even-though-Proc-Contents-shows/m-p/591604#M169503</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-09-25T16:14:55Z</dc:date>
    </item>
  </channel>
</rss>

