<?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: %SYSRC in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/827033#M326680</link>
    <description>&lt;P&gt;actually just before the code I posted I notice a command to create index but I am not able to google it or find it on sas documentation the exact function. Is it correct to guess that it is building an composite index with two var&amp;nbsp;&lt;CODE class=" language-sas"&gt;org_code, cust_no&lt;/CODE&gt; &amp;nbsp;for fast execution in searching. I.e. if the first line of _curr_customer has org_code=ABC and cust_no=0001, using the index, program will go directly to the observations in sdata.latest_customer where org_code=ABC and cust_no=0001 and no need to examine every observation in sdata.latest_customer and hence save time...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%ADD_IDX(SDATA.LATEST_CUSTOMER, I_CUSTOMER_NO,%STR(org_code, cust_no));

data sdata.latest_customer:
    set_curr_customer;
    do until(_IORC_=%SYSRC(_DSENOM));
        modify sdata.latest_customer key=i_customer_no;
        select(_IORC_);
            when (%SYSRC(_SOK)) do;
                if eff_to_date=. then do;
                    eff_to_date=t_eff_to_date;
                end;
                replace sdata.latest_customer;
            end;
            when (%SYSRC (_DSENOM)) DO;
                _error_=0;
            end;
        otherwise;
       end;
    end;
run;

data wdata.customer_h;
set wdata.customer_h (where=(eff_to_date ~= .)) 
        sdata.latest (drop=t_eff_to_date);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 04 Aug 2022 02:45:43 GMT</pubDate>
    <dc:creator>HeatherNewton</dc:creator>
    <dc:date>2022-08-04T02:45:43Z</dc:date>
    <item>
      <title>%SYSRC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/826812#M326589</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data sdata.latest_customer:
    set_curr_customer;
    do until(_IORC_=%SYSRC(_DSENOM));
        modify sdata.latest_customer key=i_customer_no;
        select(_IORC_);
            when (%SYSRC(_SOK)) do;
                if eff_to_date=. then do;
                    eff_to_date=t_eff_to_date;
                end;
                replace sdata.latest_customer;
            end;
            when (%SYSRC (_DSENOM)) DO;
                _error_=0;
            end;
        otherwise;
       end;
    end;
run;&lt;BR /&gt;
data wdata.customer_h;&lt;BR /&gt;set wdata.customer_h (where=(eff_to_date ~= .)) 
        sdata.latest (drop=t_eff_to_date);&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;
&lt;P&gt;Hi I have trouble understanding the above code, could you please assist. thanks. I did try to review in sas documentation about the variable %SYSRC but got nowhere..&lt;/P&gt;
&lt;P&gt;Thanks for your help.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 09:06:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/826812#M326589</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2022-08-03T09:06:11Z</dc:date>
    </item>
    <item>
      <title>Re: %SYSRC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/826825#M326590</link>
      <description>&lt;P&gt;This code updates / modifies values in&amp;nbsp;&lt;STRONG&gt;curr_customer&lt;/STRONG&gt;&amp;nbsp;with values from the indexed data set&amp;nbsp;&lt;STRONG&gt;sdata.latest_customer&lt;/STRONG&gt;. I assume that the line&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;set_curr_customer;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;should really be&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;set curr_customer;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The value of _IORC_ is a numeric return code that indicates the status of the&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="xisDoc-nobr"&gt;I/O&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;operation from the most recently executed MODIFY or SET statement with KEY=. The values of the _IORC_ automatic variable are internal and subject to change. Therefore it makes sense not to check the actual numeric value, but instead check the&amp;nbsp;&lt;EM&gt;Mnemonic Value&amp;nbsp;&lt;/EM&gt;of the variables. That is what we use&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://v8doc.sas.com/sashtml/macro/z0543735.htm" target="_self"&gt;%SYSRC&lt;/A&gt; for.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are a few good recourses and examples in the &lt;A href="https://documentation.sas.com/doc/en/vdmmlcdc/8.1/lestmtsref/n0g9jfr4x5hgsfn17gtma5547lt1.htm" target="_self"&gt;Modify Statement Doc&lt;/A&gt; and the&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lepg/n1kur3bt5u9wzxn1ak2wfckk61aj.htm" target="_self"&gt;Error Checking When Using Indexes to Randomly Access or Update Data&lt;/A&gt; link.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 11:07:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/826825#M326590</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-08-03T11:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: %SYSRC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/826853#M326605</link>
      <description>&lt;P&gt;%SYSRC() is not a VARIABLE.&amp;nbsp; It is a SAS defined autocall macro.&lt;/P&gt;
&lt;P&gt;To see what it does either look at the source code, or just test the usage in your example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;228  %put %SYSRC(_SOK);
0
229  %put %SYSRC(_DSENOM);
1230015
&lt;/PRE&gt;
&lt;P&gt;So zero is "_SOK", perhaps the OK in the name means everything is okay?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And 1,230,015 is "_DSENOM" which I had to look at the source to decode into english.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_0-1659532061121.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/74056iF033CC6632E30908/image-size/large?v=v2&amp;amp;px=999" role="button" title="Tom_0-1659532061121.png" alt="Tom_0-1659532061121.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 13:07:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/826853#M326605</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-08-03T13:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: %SYSRC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/826858#M326606</link>
      <description>&lt;P&gt;i find that _SOK means the function is successful&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;actually what is i_customer_no? do I have to let it to some customer no in dataset _curr_customer?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 13:19:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/826858#M326606</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2022-08-03T13:19:07Z</dc:date>
    </item>
    <item>
      <title>Re: %SYSRC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/826864#M326610</link>
      <description>&lt;P&gt;in the line&lt;/P&gt;
&lt;PRE&gt; when (%SYSRC(_SOK)) do;&lt;/PRE&gt;
&lt;P&gt;is %sysrc(_SOK) boolean? if true, do what follows?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 13:38:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/826864#M326610</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2022-08-03T13:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: %SYSRC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/826865#M326611</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/416388"&gt;@HeatherNewton&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;in the line&lt;/P&gt;
&lt;PRE&gt; when (%SYSRC(_SOK)) do;&lt;/PRE&gt;
&lt;P&gt;is %sysrc(_SOK) boolean? if true, do what follows?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;No.&lt;/P&gt;
&lt;P&gt;That is part of the SELECT/WHEN/END block.&amp;nbsp; Since the SELECT part included an expression the value in the WHEN () part is compared to the value in the SELECT () part.&amp;nbsp; So&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select(_IORC_);
  when (%SYSRC(_SOK)) do;
    if eff_to_date=. then do;
      eff_to_date=t_eff_to_date;
    end;
    replace sdata.latest_customer;
  end;
  when (%SYSRC (_DSENOM)) DO;
    _error_=0;
  end;
  otherwise;
end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;it is same as&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if _IORC_=%SYSRC(_SOK) then do;
  if eff_to_date=. then do;
    eff_to_date=t_eff_to_date;
  end;
  replace sdata.latest_customer;
end;
else if _IORC_= %SYSRC(_DSENOM) then DO;
  _error_=0;
end;
else ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 13:47:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/826865#M326611</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-08-03T13:47:56Z</dc:date>
    </item>
    <item>
      <title>Re: %SYSRC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/826884#M326620</link>
      <description>&lt;P&gt;when is _IORC_=%SYSRC(SOK) and when is _IORC_=%SYSRC(_DSENOM)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 14:33:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/826884#M326620</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2022-08-03T14:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: %SYSRC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/826888#M326624</link>
      <description>&lt;P&gt;Google helps.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.google.com/search?q=%40sas.com+_iorc_" target="_blank"&gt;https://www.google.com/search?q=%40sas.com+_iorc_&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The first hit is actually the old version 8 documentation, but since this functionality has not changed and those pages are a LOT easier to read than the new help pages why don't you start there.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://v8doc.sas.com/sashtml/lrcon/z1104667.htm" target="_blank"&gt;https://v8doc.sas.com/sashtml/lrcon/z1104667.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 14:40:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/826888#M326624</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-08-03T14:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: %SYSRC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/827007#M326669</link>
      <description>&lt;P&gt;So does it mean&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We compare each row in _curr_customer with each row in sdata.latest_customer by i_customer_no.&lt;BR /&gt;If i_customer_no matches it means _iorc_=%SYSRC(_SOK) we do:&lt;/P&gt;
&lt;P&gt;if eff_to_date=. then do;&lt;/P&gt;
&lt;P&gt;eff_to_date=t_eff_to_date;&lt;/P&gt;
&lt;P&gt;we replace the row in sdata.latest_customer with new values&lt;BR /&gt;If i_customer_id not match, assign _error_=0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;here I don’t get the line ‘do until means…’ I thought it ends when each observation in _curr_customer already compare with sdata.latest_customer…？&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 21:02:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/827007#M326669</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2022-08-03T21:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: %SYSRC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/827014#M326671</link>
      <description>&lt;P&gt;So that is different than the technical question of what %SYSRC() does.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Look at the whole data step.&lt;/P&gt;
&lt;P&gt;First thing you will notice it will end the way most data steps end,&amp;nbsp; when it reads past the end of the input.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sdata.latest_customer:
    set curr_customer;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In this case when the SET statement runs out of data to read from&amp;nbsp;curr_customer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now let's look at the DO loop.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;    do until(_IORC_=%SYSRC(_DSENOM));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Since it is a DO UNTIL() loop the DO loop will run at least once for every observation read from&amp;nbsp;curr_customer.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It then tries to use the MODIFY statement with the KEY= option.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;        modify sdata.latest_customer key=i_customer_no;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So that is going to do a few things. One is lets the data step know that the dataset listed in the DATA statement is not being built brand new, but it is just going to be modified in-place.&amp;nbsp; Second is that it will search for the observation to point to based on the index named in the KEY= option.&amp;nbsp; So whatever value for the variables that are used to make the index were read from CURR_CUSTOMER is going to be used to find the record in SDATA.LATEST_CUSTOMER.&amp;nbsp; And finally it is going to set the _IORC_ variable (and also the _ERROR_ variable) to indicate if the lookup in the index succeeded or not.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now the SELECT block is going to decide what to do based on the _IORC_ value set by the MODIFY KEY= statement.&lt;/P&gt;
&lt;P&gt;When the record is FOUND ( the value assigned to the _SOK pneumonic ) then it potentially updates the&amp;nbsp;&amp;nbsp;eff_to_date variable based on the value or the&amp;nbsp;t_eff_to_date variable read from CURR_CUSTOMER.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And when the value is not found ( the value assigned to the _DSENOM&amp;nbsp;pneumonic you asked about before) then instead it just resets the _ERROR_ flag to FALSE.&amp;nbsp; That will prevent the data step from crashing as soon it one of the values read from CURR_COSTEMER is not found.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now the UNTIL() clause is tested.&amp;nbsp; So it didn't find a record the DO loop ends.&amp;nbsp; If it did (or it got some other error) then the loop continues.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The purpose of the DO UNTIL() loop is to let you update multiple observations in&amp;nbsp;sdata.latest_customer from a single observation read from CURR_CUSTOMER. For that to actually happen the INDEX needs to be defined without the UNIQUE option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example that uses the SASHELP.CLASS dataset and AGE as the key variable for the INDEX.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class (index=(age));
  set sashelp.class;
run;

data class ;
  input age new_name $ ;
  put _n_= age= new_name= _iorc_= ;
  do loop=1 by 1 until (_iorc_=%sysrc(_dsenom)) ;
    modify class  key=age ;
    put _n_= loop= _iorc_= name= sex=;
    select(_IORC_);
      when (%SYSRC(_SOK)) do;
        name=new_name;
        replace class;
      end;
      when (%SYSRC(_DSENOM)) DO;
        _error_=0;
      end;
      otherwise;
    end;
  end;
cards;
14 Zebra 
99 Giraffe 
; 

proc print data=class;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So you can see that the one transaction record with AGE=14 changed the name on multiple observations in the WORK.CLASS dataset since the DO loop ran multiple times.&amp;nbsp; But the AGE=99 transaction is ignored since it did not match anything in the WORK.CLASS dataset.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 21:43:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/827014#M326671</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-08-03T21:43:59Z</dc:date>
    </item>
    <item>
      <title>Re: %SYSRC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/827033#M326680</link>
      <description>&lt;P&gt;actually just before the code I posted I notice a command to create index but I am not able to google it or find it on sas documentation the exact function. Is it correct to guess that it is building an composite index with two var&amp;nbsp;&lt;CODE class=" language-sas"&gt;org_code, cust_no&lt;/CODE&gt; &amp;nbsp;for fast execution in searching. I.e. if the first line of _curr_customer has org_code=ABC and cust_no=0001, using the index, program will go directly to the observations in sdata.latest_customer where org_code=ABC and cust_no=0001 and no need to examine every observation in sdata.latest_customer and hence save time...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%ADD_IDX(SDATA.LATEST_CUSTOMER, I_CUSTOMER_NO,%STR(org_code, cust_no));

data sdata.latest_customer:
    set_curr_customer;
    do until(_IORC_=%SYSRC(_DSENOM));
        modify sdata.latest_customer key=i_customer_no;
        select(_IORC_);
            when (%SYSRC(_SOK)) do;
                if eff_to_date=. then do;
                    eff_to_date=t_eff_to_date;
                end;
                replace sdata.latest_customer;
            end;
            when (%SYSRC (_DSENOM)) DO;
                _error_=0;
            end;
        otherwise;
       end;
    end;
run;

data wdata.customer_h;
set wdata.customer_h (where=(eff_to_date ~= .)) 
        sdata.latest (drop=t_eff_to_date);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Aug 2022 02:45:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/827033#M326680</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2022-08-04T02:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: %SYSRC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/827037#M326681</link>
      <description>&lt;P&gt;That is a macro call.&amp;nbsp; Look at the source code of the macro to understand what it does.&lt;/P&gt;
&lt;P&gt;Or run it with the MPRINT option turned on to see in the SAS LOG the SAS code that the macro generates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would assume that it is building an index named&amp;nbsp;I_CUSTOMER_NO on the dataset named&amp;nbsp;&amp;nbsp;SDATA.LATEST_CUSTOMER that uses the two variables&amp;nbsp;org_code and cust_no as the key variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2022 03:11:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/827037#M326681</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-08-04T03:11:37Z</dc:date>
    </item>
    <item>
      <title>Re: %SYSRC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/827051#M326687</link>
      <description>&lt;P&gt;eff_to_date exist in both sdata.latest_customer and _curr_customer&lt;/P&gt;
&lt;P&gt;t.eff_to_date exist in only _curr_customer&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for the line:&lt;/P&gt;
&lt;P&gt;if eff_to_date=. then do;&lt;/P&gt;
&lt;P&gt;eff_to_date=t_eff_to_date;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;are we assigning _curr_customer's t.eff_to_date to sdata.latest_customer's eff_to_date&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or are we assigning&amp;nbsp;_curr_customer's t.eff_to_date to _curr_customer's eff_to_date&amp;nbsp;&lt;/P&gt;
&lt;P&gt;then follow by&amp;nbsp;replacing the whole observation (with all other columns not mention here) in sdata.latest_customer?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2022 04:37:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/827051#M326687</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2022-08-04T04:37:33Z</dc:date>
    </item>
    <item>
      <title>Re: %SYSRC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/827102#M326694</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/416388"&gt;@HeatherNewton&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;eff_to_date exist in both sdata.latest_customer and _curr_customer&lt;/P&gt;
&lt;P&gt;t.eff_to_date exist in only _curr_customer&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for the line:&lt;/P&gt;
&lt;P&gt;if eff_to_date=. then do;&lt;/P&gt;
&lt;P&gt;eff_to_date=t_eff_to_date;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;are we assigning _curr_customer's t.eff_to_date to sdata.latest_customer's eff_to_date&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or are we assigning&amp;nbsp;_curr_customer's t.eff_to_date to _curr_customer's eff_to_date&amp;nbsp;&lt;/P&gt;
&lt;P&gt;then follow by&amp;nbsp;replacing the whole observation (with all other columns not mention here) in sdata.latest_customer?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;When that IF statement runs a record in&amp;nbsp;sdata.latest_customer was found.&amp;nbsp; So the value of EFF_TO_DATE is the value read from there.&amp;nbsp; &amp;nbsp;So this code is only replacing missing values of EFF_TO_DATE with the value of T_EFF_TO_DATE.&amp;nbsp; If EFF_TO_DATE in&amp;nbsp;sdata.latest_customer was not missing then it will be unchanged.&amp;nbsp; Any value of EFF_TO_DATE read from CURR_CUSTOMER is ignored (unless it has one of the variables used by the INDEX).&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2022 12:39:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/827102#M326694</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-08-04T12:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: %SYSRC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/827267#M326779</link>
      <description>&lt;P&gt;I understand for observation in sdata.latest_customer where eff_to_date is null, we replace null with value of t_eff_to_date. How about the rests of columns in the same observation, do they get replace with value from observation from _curr_customer? I reviewed the saw documentation about REPLACE, it seems indicating that the whole observation is replaced…&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also hear this is related to slow changing dimension, I am not familiar with this terminology, what is it significance here?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2022 23:43:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/827267#M326779</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2022-08-04T23:43:38Z</dc:date>
    </item>
    <item>
      <title>Re: %SYSRC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/827284#M326783</link>
      <description>&lt;P&gt;Slow changing dimension is computer speak for something that changes over time, but not very much.&amp;nbsp; Google it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the code you posted the only variable from CURR_CUSTOMER that matter are the ones that are used by the INDEX referenced in the KEY= option of the MODIFY statement and the one used to replace the value of&amp;nbsp;&lt;SPAN&gt;eff_to_date.&amp;nbsp; The reason for this is that when the MODIFY statement finds a match it reads in the observation.&amp;nbsp; So all of the variables that are in sdata.latest_customer will have any values that might have been there from CURR_CUSTOMERS replaced by the values just read in from&amp;nbsp;sdata.latest_customer.&amp;nbsp; So the IF statement is the only statement before the REPLACE statement that could make any changes to anything before it gets re-written to&amp;nbsp;sdata.latest_customer.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2022 02:38:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYSRC/m-p/827284#M326783</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-08-05T02:38:35Z</dc:date>
    </item>
  </channel>
</rss>

