<?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: where statement is not working after using a proc format. in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/where-statement-is-not-working-after-using-a-proc-format/m-p/977958#M46239</link>
    <description>&lt;P&gt;Note: It is dangerous to replace a dataset when making changes, especially when you are not sure the code is going to work.&amp;nbsp; For example if you ran your posted data step twice the second run would fail.&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;178  DATA INFORCE_SEP2025 (rename=(LOB=FLOB));
179    SET INFORCE_SEP2025;
180    format lob $FLOB.;
181    where newren eq 'N';
182  RUN;

NOTE: There were 0 observations read from the data set WORK.INFORCE_SEP2025.
      WHERE newren='N';
NOTE: The data set WORK.INFORCE_SEP2025 has 0 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds


183
184  DATA INFORCE_SEP2025 (rename=(LOB=FLOB));
185    SET INFORCE_SEP2025;
186    format lob $FLOB.;
187    where newren eq 'N';
188  RUN;

&lt;FONT color="#00FF00"&gt;NOTE: Variable lob is uninitialized.
WARNING: Variable LOB cannot be renamed to FLOB because FLOB already exists.&lt;/FONT&gt;
NOTE: There were 0 observations read from the data set WORK.INFORCE_SEP2025.
      WHERE newren='N';
NOTE: The data set WORK.INFORCE_SEP2025 has 0 observations and 3 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;If you want to use the format to CHANGE THE VALUES then perhaps you want something like this instead?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA INFORCE_SEP2025_modifed;
  SET INFORCE_SEP2025;
  where newren eq 'N';
  FLOB= put(lob,$FLOB.);
  drop lob;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 27 Oct 2025 22:43:32 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2025-10-27T22:43:32Z</dc:date>
    <item>
      <title>where statement is not working after using a proc format.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/where-statement-is-not-working-after-using-a-proc-format/m-p/977956#M46237</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have use a user define proc format below.&amp;nbsp; But when come the time to trace observations where flob in ('PONAUO','PONPRO') it is not working.&lt;/P&gt;
&lt;P&gt;How to solve that issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, if substr(flob,1,2) ='PO' and broker_group_ind eq 'IP' then substr(flob,1,2) ='PT'&amp;nbsp;&lt;/P&gt;
&lt;P&gt;how to make this mapping conversion?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value $FLOB

'COMMAUTO'='CONAUO'
'OMEGAUTO'='OMNAUO'
'PROGAUTO'='PRNAUO'
'TRUCAUTO'='TRNAUO'
'COMMPROP'='CONPRO'
'E&amp;amp;OPROP'='EONLIA'
'D&amp;amp;OPROP'='DONLIA'
'OMEGPROP'='OMNPRO'
'PROGPROP'='PRNPRO'
'NICHPROP'='NINPRO'
'MARIPROP'='CONMAR'
'FIDEPROP'='CONFID'
'CRIME'='CONFID'
'HAILFARM'='CFNHAI'
'PERSAUTO'='PONAUO'
'PERSMOTO'='PONMOO'
'PERSTOYS'='PONTOO'
'PERSPROP'='PONPRO'
'COMMSURD'='CONSUD'
'COMMSURE'='CONSUR'
'COMMSURO'='CONSUO'
'COMMFARM'='CFNPRO'
'COMMTECH'='TENEOL'
'COMMENTE'='ENNLIA'
;

run;

DATA INFORCE_SEP2025 (rename=(LOB=FLOB));
SET INFORCE_SEP2025;
format lob $FLOB.;
where newren eq 'N';
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Oct 2025 21:55:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/where-statement-is-not-working-after-using-a-proc-format/m-p/977956#M46237</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2025-10-27T21:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: where statement is not working after using a proc format.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/where-statement-is-not-working-after-using-a-proc-format/m-p/977957#M46238</link>
      <description>&lt;P&gt;Applying a format to a variable doesn't change the value stored, only how it is displayed. If you want to use a WHERE clause on a formatted value you have to use the PUT function:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where put(lob, $flob.) in ('PONAUO','PONPRO');&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Oct 2025 22:08:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/where-statement-is-not-working-after-using-a-proc-format/m-p/977957#M46238</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2025-10-27T22:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: where statement is not working after using a proc format.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/where-statement-is-not-working-after-using-a-proc-format/m-p/977958#M46239</link>
      <description>&lt;P&gt;Note: It is dangerous to replace a dataset when making changes, especially when you are not sure the code is going to work.&amp;nbsp; For example if you ran your posted data step twice the second run would fail.&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;178  DATA INFORCE_SEP2025 (rename=(LOB=FLOB));
179    SET INFORCE_SEP2025;
180    format lob $FLOB.;
181    where newren eq 'N';
182  RUN;

NOTE: There were 0 observations read from the data set WORK.INFORCE_SEP2025.
      WHERE newren='N';
NOTE: The data set WORK.INFORCE_SEP2025 has 0 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds


183
184  DATA INFORCE_SEP2025 (rename=(LOB=FLOB));
185    SET INFORCE_SEP2025;
186    format lob $FLOB.;
187    where newren eq 'N';
188  RUN;

&lt;FONT color="#00FF00"&gt;NOTE: Variable lob is uninitialized.
WARNING: Variable LOB cannot be renamed to FLOB because FLOB already exists.&lt;/FONT&gt;
NOTE: There were 0 observations read from the data set WORK.INFORCE_SEP2025.
      WHERE newren='N';
NOTE: The data set WORK.INFORCE_SEP2025 has 0 observations and 3 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;If you want to use the format to CHANGE THE VALUES then perhaps you want something like this instead?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA INFORCE_SEP2025_modifed;
  SET INFORCE_SEP2025;
  where newren eq 'N';
  FLOB= put(lob,$FLOB.);
  drop lob;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Oct 2025 22:43:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/where-statement-is-not-working-after-using-a-proc-format/m-p/977958#M46239</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-10-27T22:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: where statement is not working after using a proc format.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/where-statement-is-not-working-after-using-a-proc-format/m-p/977965#M46240</link>
      <description>&lt;P&gt;Re: your 2nd question about altering the substring, you should be able to do that exactly how you've written it:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if substr(flob,1,2) ='PO' and broker_group_ind eq 'IP' then substr(flob,1,2) ='PT';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The substr function is unusual in that it can be used on the left side of the equals sign.&amp;nbsp; Not sure if that was your question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think if you're running everything in batch / from the command line, then overwriting temp datasets is fine and actually preferable in terms of memory usage and reducing clutter and opportunities for mistakes.&amp;nbsp; But in EG / SAS Studio or other GUI, then yes, it can get you in trouble.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Oct 2025 01:22:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/where-statement-is-not-working-after-using-a-proc-format/m-p/977965#M46240</guid>
      <dc:creator>quickbluefish</dc:creator>
      <dc:date>2025-10-28T01:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: where statement is not working after using a proc format.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/where-statement-is-not-working-after-using-a-proc-format/m-p/977970#M46241</link>
      <description>Or try this one :&lt;BR /&gt;&lt;BR /&gt;if  strip(vvalue(lob)) in  ('PONAUO','PONPRO');</description>
      <pubDate>Tue, 28 Oct 2025 03:27:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/where-statement-is-not-working-after-using-a-proc-format/m-p/977970#M46241</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-10-28T03:27:38Z</dc:date>
    </item>
  </channel>
</rss>

