<?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: The variable never been referenced in the keep statement %3F%3F%3F%3F in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/The-variable-never-been-referenced-in-the-keep-statement-3F-3F/m-p/976578#M46201</link>
    <description>&lt;P&gt;As an aside, you might want to consider use of "not quite a date" variable like your "AccountingYearMonth" with apparent plain numeric values of 202509. Use an actual date value that represents the first day of the month to allow use of the SAS functions that will deal with increments and intervals . You can assign a format to the values that would have a default appearance of YYYYMM.&lt;/P&gt;
&lt;P&gt;Your code&lt;/P&gt;
&lt;PRE&gt;accountingYearMonth LE 202509&lt;/PRE&gt;
&lt;P&gt;would become&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;accountingYearMonth LE "01Sep2025"D&lt;/PRE&gt;
&lt;P&gt;which is, in my opinion, a bit clearer to follow the intent of the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS understands dates for many of the graphing procedures to do things like place tick marks at month or quarter intervals but graphing something with values like 202509 means a&amp;nbsp;&lt;STRONG&gt;big&lt;/STRONG&gt; gap between 202512 and 202601.&lt;/P&gt;
&lt;P&gt;Plus the modeling and analysis procedures can use the intervals.&lt;/P&gt;
&lt;P&gt;Not to mention simple things like the functions such as Quarter that would let you select a calendar quarter or a minor format change in a report could change the intervals from monthly to quarterly or annually&lt;/P&gt;</description>
    <pubDate>Tue, 07 Oct 2025 16:50:08 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2025-10-07T16:50:08Z</dc:date>
    <item>
      <title>The variable never been referenced in the keep statement %3F%3F%3F%3F</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/The-variable-never-been-referenced-in-the-keep-statement-3F-3F/m-p/976563#M46195</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;LibName trx SPDE "/.../transaction/" ;

%Let varToKeep =
system lineOfBusiness distribution company companyDivision region province accountingYear accountingYearMonth writtenPremium writtenUnit driverType ;

Data harmony_trx ;
Set trx.prm_trx_: (Keep=&amp;amp;varToKeep. );
Where accountingYear ge 2024 And accountingYearMonth LE 202509;

If distribution = 'Prestige' Then distribution = 'Broker';
If driverType = 'Occasional' Then writtenUnit = 0;
Run;

proc freq data=harmony_trx;
table driverType;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;the log file:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;29 &lt;BR /&gt;30 %Let varToKeep =&lt;BR /&gt;31 system lineOfBusiness distribution company companyDivision region province accountingYear accountingYearMonth&lt;BR /&gt;31 ! writtenPremium writtenUnit driverType ;&lt;BR /&gt;32 &lt;BR /&gt;33 Data harmony_trx ;&lt;BR /&gt;34 Set trx.prm_trx_: (Keep=&amp;amp;varToKeep. );&lt;/P&gt;
&lt;P&gt;WARNING: The variable driverType in the DROP, KEEP, or RENAME list has never been referenced.&lt;BR /&gt;WARNING: The variable driverType in the DROP, KEEP, or RENAME list has never been referenced.&lt;BR /&gt;WARNING: The variable driverType in the DROP, KEEP, or RENAME list has never been referenced.&lt;BR /&gt;WARNING: The variable driverType in the DROP, KEEP, or RENAME list has never been referenced.&lt;BR /&gt;WARNING: The variable driverType in the DROP, KEEP, or RENAME list has never been referenced.&lt;BR /&gt;WARNING: The variable driverType in the DROP, KEEP, or RENAME list has never been referenced.&lt;BR /&gt;WARNING: The variable driverType in the DROP, KEEP, or RENAME list has never been referenced.&lt;BR /&gt;WARNING: The variable driverType in the DROP, KEEP, or RENAME list has never been referenced.&lt;BR /&gt;WARNING: The variable driverType in the DROP, KEEP, or RENAME list has never been referenced.&lt;/P&gt;
&lt;P&gt;WARNING: The variable driverType in the DROP, KEEP, or RENAME list has never been referenced.&lt;BR /&gt;35 Where accountingYear ge 2024 And accountingYearMonth LE 202509;&lt;BR /&gt;36 &lt;BR /&gt;37 If distribution = 'Prestige' Then distribution = 'Broker';&lt;BR /&gt;38 If driverType = 'Occasional' Then writtenUnit = 0;&lt;BR /&gt;39 Run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How to solve that issue because the driverType variable is really into the dataset&lt;/P&gt;</description>
      <pubDate>Tue, 07 Oct 2025 14:31:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/The-variable-never-been-referenced-in-the-keep-statement-3F-3F/m-p/976563#M46195</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2025-10-07T14:31:06Z</dc:date>
    </item>
    <item>
      <title>Re: The variable never been referenced in the keep statement %3F%3F%3F%3F</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/The-variable-never-been-referenced-in-the-keep-statement-3F-3F/m-p/976565#M46197</link>
      <description>&lt;P&gt;Your SET statement is reading in multiple data sets.&amp;nbsp; It looks like at least some of the data sets do not have the driverType variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to turn off this warning message, you can set the system option DKRICOND=NOWARNING.&amp;nbsp; &amp;nbsp;But records from the data sets which do not have this variable will still end up with a missing value.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Oct 2025 14:41:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/The-variable-never-been-referenced-in-the-keep-statement-3F-3F/m-p/976565#M46197</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2025-10-07T14:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: The variable never been referenced in the keep statement %3F%3F%3F%3F</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/The-variable-never-been-referenced-in-the-keep-statement-3F-3F/m-p/976567#M46198</link>
      <description>&lt;P&gt;It is a good idea.&amp;nbsp; I have 14 datasets to check, using proc contents.&amp;nbsp; I will come back after to let you know what I have found&lt;/P&gt;</description>
      <pubDate>Tue, 07 Oct 2025 14:52:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/The-variable-never-been-referenced-in-the-keep-statement-3F-3F/m-p/976567#M46198</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2025-10-07T14:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: The variable never been referenced in the keep statement %3F%3F%3F%3F</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/The-variable-never-been-referenced-in-the-keep-statement-3F-3F/m-p/976572#M46199</link>
      <description>I have found the issue&lt;BR /&gt;Effectively, the variable is not found into all datsets.   The  option DKRICOND=NOWARNING will do the job.&lt;BR /&gt;</description>
      <pubDate>Tue, 07 Oct 2025 15:17:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/The-variable-never-been-referenced-in-the-keep-statement-3F-3F/m-p/976572#M46199</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2025-10-07T15:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: The variable never been referenced in the keep statement %3F%3F%3F%3F</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/The-variable-never-been-referenced-in-the-keep-statement-3F-3F/m-p/976575#M46200</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/76331"&gt;@alepage&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have 14 datasets to check, using proc contents.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;For future checks like this (especially if more datasets are involved) you may want to consider querying DICTIONARY.COLUMNS rather than reviewing a lot of PROC CONTENTS output:&lt;/P&gt;
&lt;PRE&gt;/* List all TRX.PRM_TRX_... datasets not containing variable driverType */

proc sql;
select memname
from dictionary.columns
where libname='&lt;STRONG&gt;TRX&lt;/STRONG&gt;' &amp;amp; memname eqt '&lt;STRONG&gt;PRM_TRX_&lt;/STRONG&gt;'
group by 1
having max(upcase(name)='&lt;STRONG&gt;DRIVERTYPE&lt;/STRONG&gt;')=0;
quit;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Oct 2025 16:18:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/The-variable-never-been-referenced-in-the-keep-statement-3F-3F/m-p/976575#M46200</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2025-10-07T16:18:48Z</dc:date>
    </item>
    <item>
      <title>Re: The variable never been referenced in the keep statement %3F%3F%3F%3F</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/The-variable-never-been-referenced-in-the-keep-statement-3F-3F/m-p/976578#M46201</link>
      <description>&lt;P&gt;As an aside, you might want to consider use of "not quite a date" variable like your "AccountingYearMonth" with apparent plain numeric values of 202509. Use an actual date value that represents the first day of the month to allow use of the SAS functions that will deal with increments and intervals . You can assign a format to the values that would have a default appearance of YYYYMM.&lt;/P&gt;
&lt;P&gt;Your code&lt;/P&gt;
&lt;PRE&gt;accountingYearMonth LE 202509&lt;/PRE&gt;
&lt;P&gt;would become&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;accountingYearMonth LE "01Sep2025"D&lt;/PRE&gt;
&lt;P&gt;which is, in my opinion, a bit clearer to follow the intent of the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS understands dates for many of the graphing procedures to do things like place tick marks at month or quarter intervals but graphing something with values like 202509 means a&amp;nbsp;&lt;STRONG&gt;big&lt;/STRONG&gt; gap between 202512 and 202601.&lt;/P&gt;
&lt;P&gt;Plus the modeling and analysis procedures can use the intervals.&lt;/P&gt;
&lt;P&gt;Not to mention simple things like the functions such as Quarter that would let you select a calendar quarter or a minor format change in a report could change the intervals from monthly to quarterly or annually&lt;/P&gt;</description>
      <pubDate>Tue, 07 Oct 2025 16:50:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/The-variable-never-been-referenced-in-the-keep-statement-3F-3F/m-p/976578#M46201</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2025-10-07T16:50:08Z</dc:date>
    </item>
  </channel>
</rss>

