<?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: Changing value for one cell with CASE WHEN THEN in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Changing-value-for-one-cell-with-CASE-WHEN-THEN/m-p/669244#M200737</link>
    <description>&lt;P&gt;Write out what you are trying to do in pseudo-code. Or give a clear example for at least two IDs, one of them 3333 and another ID that is handled differently.&lt;/P&gt;</description>
    <pubDate>Tue, 14 Jul 2020 17:10:22 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-07-14T17:10:22Z</dc:date>
    <item>
      <title>Changing value for one cell with CASE WHEN THEN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-value-for-one-cell-with-CASE-WHEN-THEN/m-p/669236#M200733</link>
      <description>&lt;P&gt;Apologies if answers to this exist, I couldn't find them.&lt;/P&gt;&lt;P&gt;I'm a SAS beginner, I use SAS EG 9.1 for work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I successfully replaced values of 'none' within a column of IDs (CF_WRKR) with the statement below.&lt;/P&gt;&lt;P&gt;Problem is, one of the cell was not changed to an ID, and that's because it's last value falls outside of the date range that I was asked to look into for the client (March 1 to 30, 2020). Plot twist: the client still wants that value.&lt;/P&gt;&lt;P&gt;SO! I have to change the date range only for that cell (I need the date to start FEB 1st for that cell).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two tables that I join to achieve this values transformation business TCF_DATA (in which cf_wrkr is with the 'none' values) and WRKR2 (in which cf_wrkr2 is with the missing values to replace 'none').&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use the statement below to join them and do the 'none' values replacement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I decided to try adding a second CASE WHEN THEN command in this statement to try change the date range (wr.paEnd) only for that one cell with ID 3333.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BUT Just can't get it done. &lt;FONT color="#0000FF"&gt;&lt;EM&gt;What am I missing, do I need to actually do a data nature change (i.e. they're all character but the date), is there a way to do this more simply for the data change for that cell?&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;CODE&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;Proc sql;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT color="#0000FF"&gt;create table&lt;/FONT&gt; DATANEW &lt;FONT color="#0000FF"&gt;as&lt;/FONT&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;FONT color="#0000FF"&gt;select distinct&lt;/FONT&gt; &lt;FONT color="#33CCCC"&gt;tc.&lt;FONT color="#000000"&gt;*&lt;/FONT&gt;&lt;/FONT&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;,wr.casenum &lt;FONT color="#0000FF"&gt;as&lt;/FONT&gt; wrcasenum&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ,wr.CF_WRKR2&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ,wr.paBeg&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ,wr.paEnd&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT color="#0000FF"&gt; ,CASE&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;WHEN&lt;/FONT&gt; (tc.cf_wrkr = &lt;FONT color="#800080"&gt;'none'&lt;/FONT&gt;) &lt;FONT color="#0000FF"&gt;THEN&lt;/FONT&gt; wr.cf_wrkr2&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;FONT color="#0000FF"&gt;else&lt;/FONT&gt; tc.cf_wrkr&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;FONT color="#0000FF"&gt;end as&lt;/FONT&gt; updtWRKR&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;FONT color="#0000FF"&gt;WHEN&lt;/FONT&gt; (tc.serial = &lt;FONT color="#800080"&gt;'3333'&lt;/FONT&gt;) &lt;FONT color="#0000FF"&gt;THEN&lt;/FONT&gt; (wr.paEnd &amp;gt;= &lt;FONT color="#008080"&gt;"01FEB2020"d&lt;/FONT&gt;)&amp;nbsp; &lt;FONT color="#99CC00"&gt;&amp;nbsp;&lt;FONT size="1 2 3 4 5 6 7"&gt;/*this is the second stt added to change &lt;/FONT&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT color="#0000FF"&gt;else&lt;/FONT&gt; wr.paEnd&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;FONT color="#99CC00"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;date for one cell*/&amp;nbsp;&lt;/FONT&gt; &amp;nbsp; &lt;/FONT&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT color="#0000FF"&gt;end as&lt;/FONT&gt; updtCASE&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;FONT color="#0000FF"&gt;from&lt;/FONT&gt; TCF_data tc&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT color="#0000FF"&gt; left join&lt;/FONT&gt; WRKR2 wr&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;FONT color="#0000FF"&gt;on&lt;/FONT&gt; wr.pgmid = tc.PID&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; order by&lt;/FONT&gt; serial;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;Quit;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;ERRORS I'm getting:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; WHEN (tc.serial = 'A816659') THEN (wr.paEnd &amp;gt;= "01FEB2020"d)&lt;U&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;____&lt;/FONT&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/U&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;78&lt;/FONT&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;76&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;ERROR 78-322: Expecting a ','.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When trying different things such as commas in different spots, changing brackets or parentheses, I get other errors such as these two:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;ERROR: Syntax error&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;ERROR: Result of WHEN clause 2 is not the same data type as the preceding results.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much for your feedback!&lt;/P&gt;&lt;P&gt;Hope I was clear enough.&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;</description>
      <pubDate>Tue, 14 Jul 2020 16:39:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-value-for-one-cell-with-CASE-WHEN-THEN/m-p/669236#M200733</guid>
      <dc:creator>Maycrow</dc:creator>
      <dc:date>2020-07-14T16:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: Changing value for one cell with CASE WHEN THEN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-value-for-one-cell-with-CASE-WHEN-THEN/m-p/669239#M200734</link>
      <description>&lt;P&gt;I don't think the last line of this snippet is valid syntax&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT color="#0000FF"&gt;CASE &lt;/FONT&gt;&lt;FONT color="#0000FF"&gt;WHEN&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;(tc.cf_wrkr =&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#800080"&gt;'none'&lt;/FONT&gt;&lt;SPAN&gt;)&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#0000FF"&gt;THEN&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;wr.cf_wrkr2&lt;/SPAN&gt;&lt;BR /&gt;    &lt;FONT color="#0000FF"&gt;else&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;tc.cf_wrkr&lt;/SPAN&gt;&lt;BR /&gt;    &lt;FONT color="#0000FF"&gt;end as&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;updtWRKR&lt;/SPAN&gt;&lt;BR /&gt;    &lt;FONT color="#0000FF"&gt;WHEN&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;(tc.serial =&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#800080"&gt;'3333'&lt;/FONT&gt;&lt;SPAN&gt;)&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#0000FF"&gt;THEN&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;(wr.paEnd &amp;gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#008080"&gt;"01FEB2020"d&lt;/FONT&gt;&lt;SPAN&gt;)&amp;nbsp;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;What you probably want (although I'm not really sure) is&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;CASE WHEN (tc.cf_wrkr = 'none') THEN wr.cf_wrkr2
    else tc.cf_wrkr
    end as updtWRKR,
case WHEN (tc.serial = '3333') THEN (wr.paEnd &amp;gt;= "01FEB2020"d) 
    else /* some valid code here*/ end as variablename&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Although I still find the above confusing and probably wrong, because wr.paEnd&amp;gt;="01FEB2020"d is either a 1 or a 0 (assuming wr.paEnd is numeric).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe what you want (again, I will say I'm confused) is this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case WHEN (tc.serial = '3333') and (wr.paEnd &amp;gt;= "01FEB2020"d) then /* some valid code here */
    else /* some valid code here*/ end as variablename&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For future reference, when you need to show us the log, you need to preserve the formatting of the log so that the error message underlines appear underneath the part of the code where the problem exists (which the log you show does not do). To preserve the formatting, copy the log as text and paste it (as text) into the window that appears when you click on the &amp;lt;/&amp;gt; icon. DO NOT SKIP THIS STEP.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2020 16:55:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-value-for-one-cell-with-CASE-WHEN-THEN/m-p/669239#M200734</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-07-14T16:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: Changing value for one cell with CASE WHEN THEN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-value-for-one-cell-with-CASE-WHEN-THEN/m-p/669242#M200735</link>
      <description>&lt;P&gt;Thank you, I'll check in on your suggestions.&lt;/P&gt;&lt;P&gt;To answer your question, when I look at the top of the column to see it's type, the&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT color="#008080"&gt;"01FEB2020"d&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;says type: DATE&lt;/P&gt;&lt;P&gt;That's why I was wondering if I have to do some kind of transformation of that date type into a character value?&lt;/P&gt;&lt;P&gt;Thoughts?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2020 17:00:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-value-for-one-cell-with-CASE-WHEN-THEN/m-p/669242#M200735</guid>
      <dc:creator>Maycrow</dc:creator>
      <dc:date>2020-07-14T17:00:51Z</dc:date>
    </item>
    <item>
      <title>Re: Changing value for one cell with CASE WHEN THEN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-value-for-one-cell-with-CASE-WHEN-THEN/m-p/669243#M200736</link>
      <description>This would have been a good idea, but my issue is that I'm trying to tell the machine, if the serial 3333 appears then I don't want you to search from March 1st anymore, but from February 1st instead. Makes sense? So I don't think I should do&lt;BR /&gt;&lt;BR /&gt;case WHEN (tc.serial = '3333') and (wr.paEnd &amp;gt;= "01FEB2020"d) then ...&lt;BR /&gt;&lt;BR /&gt;with the 'and' because February does not exist in the date range I selected upstream in the code. Makes sense? That's why I'm trying with THEN...&lt;BR /&gt;But maybe SAS thinks differently?&lt;BR /&gt;Thoughts?</description>
      <pubDate>Tue, 14 Jul 2020 17:05:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-value-for-one-cell-with-CASE-WHEN-THEN/m-p/669243#M200736</guid>
      <dc:creator>Maycrow</dc:creator>
      <dc:date>2020-07-14T17:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: Changing value for one cell with CASE WHEN THEN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-value-for-one-cell-with-CASE-WHEN-THEN/m-p/669244#M200737</link>
      <description>&lt;P&gt;Write out what you are trying to do in pseudo-code. Or give a clear example for at least two IDs, one of them 3333 and another ID that is handled differently.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2020 17:10:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-value-for-one-cell-with-CASE-WHEN-THEN/m-p/669244#M200737</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-07-14T17:10:22Z</dc:date>
    </item>
    <item>
      <title>Re: Changing value for one cell with CASE WHEN THEN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-value-for-one-cell-with-CASE-WHEN-THEN/m-p/669256#M200742</link>
      <description>OK, not sure what you mean by pseudo code, but here is more background:&lt;BR /&gt;&lt;BR /&gt;Original tables------------------&lt;BR /&gt;&lt;BR /&gt;SERIAL CF_WRKR CF_WRKR2 BEG_DATE END_DATE&lt;BR /&gt;3333 none . 03/01/2020 03/30/2020&lt;BR /&gt;4564 none BCF45G6 03/01/2020 03/30/2020&lt;BR /&gt;&lt;BR /&gt;Output desired -----------&lt;BR /&gt;&lt;BR /&gt;SERIAL CF_WRKR CF_WRKR2 BEG_DATE END_DATE&lt;BR /&gt;3333 VGD5T67 VGD5T67 02/01/2020 03/30/2020&lt;BR /&gt;4564 BCF45G6 BCF45G6 03/01/2020 03/30/2020&lt;BR /&gt;&lt;BR /&gt;/*Note the date change for 3333 that now should start at Feb1 instead of March 1 to pull its latest ID that is no more there in March (person was discontinued after Feb)*/&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The code below is the code where I have a date range top pull ID information for March. For all the IDs this is the code that pulls them up. So my column CF_WRKR2 displays all the IDs that show up in the system for March 2020.&lt;BR /&gt;For ID 3333, I still get a 'none' assigned (it's the only one for which it happens).&lt;BR /&gt;So for that 3333 ID, I can't use the same date range anymore like below, instead I have to pull it from February 2020. SO I don't want to bother this code, I want to change the date for that case in the code I have sent previously.&lt;BR /&gt;&lt;BR /&gt;--------------------------------&lt;BR /&gt;FULL CODE&lt;BR /&gt;--------------------------------&lt;BR /&gt;proc sql;&lt;BR /&gt;&amp;amp;EDR;&lt;BR /&gt;create table WRKR as&lt;BR /&gt;Select distinct a.*&lt;BR /&gt;FROM&lt;BR /&gt;(select * from connection to edr_civ&lt;BR /&gt;(SELECT&lt;BR /&gt;c.SERIAL_NUM_IDENTIF as casenum&lt;BR /&gt;,PGM.PGM_CODE&lt;BR /&gt;,PGM.CASE_ID&lt;BR /&gt;,PGM.ID as pgmID&lt;BR /&gt;,PGM_DETL.stat_code as pgmStat&lt;BR /&gt;,STAFF.COUNTY_CODE&lt;BR /&gt;,staff_wrkr.pos_ID&lt;BR /&gt;,staff_wrkr.wrkr_num_identif as CF_WRKR2&lt;BR /&gt;,PGM_ASSIGN.PGM_ID as paID&lt;BR /&gt;,PGM_ASSIGN.POS_ID as paPoID&lt;BR /&gt;,PGM_ASSIGN.BEG_DATE as paBeg&lt;BR /&gt;,PGM_ASSIGN.END_DATE as paEnd&lt;BR /&gt;,POS.ID&lt;BR /&gt;,PGM_DETL.BEG_DATE as pdBeg&lt;BR /&gt;,PGM_DETL.END_DATE as pdEnd&lt;BR /&gt;,PGM_DETL.stat_code as statcode&lt;BR /&gt;,STAFF_POS_ASSIGN.BEG_DATE as spobgdt&lt;BR /&gt;,STAFF_POS_ASSIGN.END_DATE as spoendt&lt;BR /&gt;&lt;BR /&gt;From dbo. [case] as c&lt;BR /&gt;inner join dbo.pgm&lt;BR /&gt;on c.id = pgm.case_id&lt;BR /&gt;inner join dbo.PGM_DETL&lt;BR /&gt;on PGM.ID = PGM_DETL.PGM_ID&lt;BR /&gt;inner join dbo.PGM_ASSIGN&lt;BR /&gt;on PGM_ASSIGN.PGM_ID = pgm.ID&lt;BR /&gt;inner join dbo.POS&lt;BR /&gt;on POS.ID = PGM_ASSIGN.POS_ID&lt;BR /&gt;inner join dbo.staff_wrkr&lt;BR /&gt;on POS.ID = staff_wrkr.POS_ID&lt;BR /&gt;inner join dbo.STAFF_POS_ASSIGN&lt;BR /&gt;on STAFF_POS_ASSIGN.POS_ID = POS.ID&lt;BR /&gt;inner join dbo.STAFF&lt;BR /&gt;on STAFF.ID =STAFF_POS_ASSIGN.STAFF_ID&lt;BR /&gt;&lt;BR /&gt;WHERE&lt;BR /&gt;pgm.pgm_code = 'FS'&lt;BR /&gt;/* AND PGM_DETL.stat_code = 'DS' */&lt;BR /&gt;AND STAFF.COUNTY_CODE = '33'&lt;BR /&gt;AND PGM_ASSIGN.END_DATE &amp;gt;= '03/01/2020'&lt;BR /&gt;AND PGM_ASSIGN.END_DATE &amp;gt;= STAFF_POS_ASSIGN.BEG_DATE&lt;BR /&gt;AND STAFF_POS_ASSIGN.END_DATE &amp;gt;='03/01/2020'&lt;BR /&gt;AND STAFF_POS_ASSIGN.END_DATE &amp;gt;= PGM_ASSIGN.BEG_DATE&lt;BR /&gt;AND PGM_ASSIGN.BEG_DATE &amp;lt;= '04/01/2020'&lt;BR /&gt;AND STAFF_POS_ASSIGN.BEG_DATE &amp;lt;= '04/01/2020'&lt;BR /&gt;&lt;BR /&gt;ORDER BY casenum, paID, paEnd desc) as a);&lt;BR /&gt;&lt;BR /&gt;disconnect from edr_civ;&lt;BR /&gt;Quit;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 14 Jul 2020 18:22:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-value-for-one-cell-with-CASE-WHEN-THEN/m-p/669256#M200742</guid>
      <dc:creator>Maycrow</dc:creator>
      <dc:date>2020-07-14T18:22:46Z</dc:date>
    </item>
    <item>
      <title>Re: Changing value for one cell with CASE WHEN THEN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-value-for-one-cell-with-CASE-WHEN-THEN/m-p/669267#M200745</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/290158"&gt;@Maycrow&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;OK, not sure what you mean by pseudo code, but here is more background:&lt;BR /&gt;&lt;BR /&gt;Original tables------------------&lt;BR /&gt;&lt;BR /&gt;SERIAL CF_WRKR CF_WRKR2 BEG_DATE END_DATE&lt;BR /&gt;3333 none . 03/01/2020 03/30/2020&lt;BR /&gt;4564 none BCF45G6 03/01/2020 03/30/2020&lt;BR /&gt;&lt;BR /&gt;Output desired -----------&lt;BR /&gt;&lt;BR /&gt;SERIAL CF_WRKR CF_WRKR2 BEG_DATE END_DATE&lt;BR /&gt;3333 VGD5T67 VGD5T67 02/01/2020 03/30/2020&lt;BR /&gt;4564 BCF45G6 BCF45G6 03/01/2020 03/30/2020&lt;BR /&gt;&lt;BR /&gt;/*Note the date change for 3333 that now should start at Feb1 instead of March 1 to pull its latest ID that is no more there in March (person was discontinued after Feb)*/&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So you just want to change beg_date to 2/1/2020 for 3333?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    if serial='3333' then beg_date='01FEB2020'd;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Jul 2020 18:43:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-value-for-one-cell-with-CASE-WHEN-THEN/m-p/669267#M200745</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-07-14T18:43:20Z</dc:date>
    </item>
  </channel>
</rss>

