<?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: Creating a from_to table - My program does not satisfy the test case I built? What is the error? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-from-to-table-My-program-does-not-satisfy-the-test/m-p/881911#M348467</link>
    <description>&lt;P&gt;You can generalize your macro for multiple segments if there are going to be segments beyond the first two:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
%macro update_historyN(snapshot,segment);                                                                                                       
data historic_info_customers;                                                                                                           
  set &amp;amp;snapshot;                                                                                                                        
  valid_to_date='31dec9999'd;
  segment_generation = trim("segment_generation_&amp;amp;segment");
  modify historic_info_customers key=idx2;                                                                                               
  if not _iorc_ then do;                                                                                                                
    if segment_belonging ne segment_generation_&amp;amp;segment then do;                               
      valid_to_date=date-1;                                                                                                             
      replace;                                                                                                                          
      valid_from_date=date;                                                                                                             
      valid_to_date='31dec9999'd;                                                                                                       
      segment_generation=trim("segment_generation_&amp;amp;segment");                                                                                        
      segment_belonging=segment_generation_&amp;amp;segment;                                                                                           
      output;                                                                                                                           
      end;                                                                                                                              
    end;                                                                                                                                
  else do;                                                                                                                              
    _error_=0;                                                                                                                          
    valid_from_date=date;                                                                                                               
    valid_to_date='31dec9999'd;                                                                                                         
    segment_generation=trim("segment_generation_&amp;amp;segment");                                                                                          
    segment_belonging=segment_generation_&amp;amp;segment;                                                                                             
    output;                                                                                                                             
    end;                                                                                                                                
  run;                                                                                                                                  
%mend;          

data customer_table_snapshot_6;
   input date :yymmdd10. customer_id segment_generation_1 $  segment_generation_2 $ segment_generation_3 $;
   format date yymmdd10.;
   datalines;
   2023-09-27 111 A C D
   2023-09-27 222 C C E
   2023-09-27 333 B B F
   ;
run;
data customer_table_snapshot_7;
   input date :yymmdd10. customer_id segment_generation_1 $  segment_generation_2 $ segment_generation_3 $;
   format date yymmdd10.;
   datalines;
   2023-10-21 111 A C F
   2023-10-21 222 C C E
   2023-10-21 333 B B D
   ;
run;


%update_historyN(customer_table_snapshot_6,3);                                                                                            
%update_historyN(customer_table_snapshot_7,3);                                                                                            

data actual_result; 
	set historic_info_customers;
run; 

proc sort data=actual_result; 
	by customer_id segment_generation valid_from_date; 
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 22 Jun 2023 14:29:42 GMT</pubDate>
    <dc:creator>Daryl</dc:creator>
    <dc:date>2023-06-22T14:29:42Z</dc:date>
    <item>
      <title>Creating a from_to table - My program does not satisfy the test case I built? What is the error?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-from-to-table-My-program-does-not-satisfy-the-test/m-p/881519#M348314</link>
      <description>&lt;P&gt;Hi, I have written a program that is clearly commented so by looking at the code and results you should be able to clearly see what the problem is (you can directly copy-paste-run the code) :&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*
One customer can move between different segments. 
There can also come new segment generations. 

This program:
1. Simulates how a customer table can look at specific
timepoints (snapshots). 
2. Then the expected result are printed out in a table. 

3. A "from to" table is created to follow the customers
segment belonging at different periods. 

4. We see that row 3, 4 and 18 from the resulting table ("actual_result")
differ from the "expected result" at the bottom of the program. 
I cannot figure out why this happens? 
*/


/*--------------------------------------------------------------*/
/* Creating test data. */
/* Used for creating an expected test result in the next section. */
/*--------------------------------------------------------------*/

/*The customer table at the "beginning". */
data customer_table_snapshot_1;
   input date :yymmdd10. customer_id segment_generation_1 $;
   format date yymmdd10.;
   datalines;
   2023-01-01 111 A
   2023-01-01 222 B
   2023-01-01 333 C
   ;
run;

/*Customers have changed segment but still within segment_generation_1.*/
data customer_table_snapshot_2;
   input date :yymmdd10. customer_id segment_generation_1 $;
   format date yymmdd10.;
   datalines;
   2023-01-07 111 A
   2023-01-07 222 C
   2023-01-07 333 A
   ;
run;

/*Now a new column segment_generation_2 has been added. */
data customer_table_snapshot_3;
   input date :yymmdd10. customer_id segment_generation_1 $  segment_generation_2 $ ;
   format date yymmdd10.;
   datalines;
   2023-01-10 111 B A
   2023-01-10 222 C C
   2023-01-10 333 A C
   ;
run;

/*Now both the segment_generation_1 and segment_generation_2 has changed. */
/*This is so that we can make sure the method can handle that two columns change.*/
data customer_table_snapshot_4;
   input date :yymmdd10. customer_id segment_generation_1 $  segment_generation_2 $ ;
   format date yymmdd10.;
   datalines;
   2023-01-15 111 A B
   2023-01-15 222 C B
   2023-01-15 333 B B
   ;
run;

data customer_table_snapshot_5;
   input date :yymmdd10. customer_id segment_generation_1 $  segment_generation_2 $ ;
   format date yymmdd10.;
   datalines;
   2023-02-20 111 A C
   2023-02-20 222 C C
   2023-02-20 333 B B
   ;
run;


/*--------------------------------------------------------------*/
/* Expected result from using test data. */
/*--------------------------------------------------------------*/

data expected_from_to_result; 
	LENGTH customer_id 8 segment_generation $ 100 segment_belonging $ 1 valid_from_date 8 valid_to_date 8;
	input customer_id segment_generation $ segment_belonging $ valid_from_date :yymmdd10. valid_to_date :yymmdd10.;
	format valid_from_date yymmdd10. valid_to_date yymmdd10.;
	datalines;
	111 segment_generation_1 A 2023-01-01 2023-01-09
	111 segment_generation_1 B 2023-01-10 2023-01-14
	111 segment_generation_1 A 2023-01-15 9999-12-31

	111 segment_generation_2 A 2023-01-10 2023-01-14
	111 segment_generation_2 B 2023-01-15 2023-02-19
	111 segment_generation_2 C 2023-02-20 9999-12-31



	222 segment_generation_1 B 2023-01-01 2023-01-06
	222 segment_generation_1 C 2023-01-07 9999-12-31

	222 segment_generation_2 C 2023-01-10 2023-01-14
	222 segment_generation_2 B 2023-01-15 2023-02-19
	222 segment_generation_2 C 2023-02-20 9999-12-31



	333 segment_generation_1 C 2023-01-01 2023-01-06
	333 segment_generation_1 A 2023-01-07 2023-01-14
	333 segment_generation_1 B 2023-01-15 9999-12-31

	333 segment_generation_2 C 2023-01-10 2023-01-14
	333 segment_generation_2 B 2023-01-15 9999-12-31
	;
run; 

proc sort data=expected_from_to_result; 
	by customer_id segment_generation valid_from_date; 
run; 

/*--------------------------------------------------------------*/
/* Creating a from_to table*/
/*--------------------------------------------------------------*/

data historic_info_customers;                                                                                                           
      LENGTH customer_id 8 segment_generation $ 100 segment_belonging $ 1 valid_from_date 8 valid_to_date 8;                            
      format valid_from_date yymmdd10. valid_to_date yymmdd10.;                                                                         
  stop;                                                                                                                                 
run;        
 
proc sql;                                                                                                                               
  create index idx on historic_info_customers(customer_ID,valid_to_date);                                                               
quit;

%macro update_history1(snapshot);                                                                                                                                                                                                                                              
data historic_info_customers;                                                                                                           
  set &amp;amp;snapshot;                                                                                                                        
  valid_to_date='31dec9999'd;                                                                                                           
  modify historic_info_customers key=idx;                                                                                               
  if not _iorc_ then do;                                                                                                                
    if segment_belonging ne segment_generation_1 then do;                                                                               
      valid_to_date=date-1;                                                                                                             
      replace;                                                                                                                          
      valid_from_date=date;                                                                                                             
      valid_to_date='31dec9999'd;                                                                                                       
      segment_generation='segment_generation_1';                                                                                        
      segment_belonging=segment_generation_1;                                                                                           
      output;                                                                                                                           
      end;                                                                                                                              
    end;                                                                                                                                
  else do;                                                                                                                              
    _error_=0;                                                                                                                          
    valid_from_date=date;                                                                                                               
    valid_to_date='31dec9999'd;                                                                                                         
    segment_generation='segment_generation_1';                                                                                          
    segment_belonging=segment_generation_1;                                                                                             
    output;                                                                                                                             
    end;                                                                                                                                
  run;                                                                                                                                  
%mend;     
 
%update_history1(customer_table_snapshot_1);                                                                                            
%update_history1(customer_table_snapshot_2);
%update_history1(customer_table_snapshot_3);                                                                                            
%update_history1(customer_table_snapshot_4);
%update_history1(customer_table_snapshot_5);                                                                                            

%macro update_history2(snapshot);                                                                                                       
data historic_info_customers;                                                                                                           
  set &amp;amp;snapshot;                                                                                                                        
  valid_to_date='31dec9999'd;                                                                                                           
  modify historic_info_customers key=idx;                                                                                               
  if not _iorc_ then do;                                                                                                                
    if segment_belonging ne segment_generation_2 or segment_generation ne 'segment_generation_2' then do;                               
      valid_to_date=date-1;                                                                                                             
      replace;                                                                                                                          
      valid_from_date=date;                                                                                                             
      valid_to_date='31dec9999'd;                                                                                                       
      segment_generation='segment_generation_2';                                                                                        
      segment_belonging=segment_generation_2;                                                                                           
      output;                                                                                                                           
      end;                                                                                                                              
    end;                                                                                                                                
  else do;                                                                                                                              
    _error_=0;                                                                                                                          
    valid_from_date=date;                                                                                                               
    valid_to_date='31dec9999'd;                                                                                                         
    segment_generation='segment_generation_2';                                                                                          
    segment_belonging=segment_generation_2;                                                                                             
    output;                                                                                                                             
    end;                                                                                                                                
  run;                                                                                                                                  
%mend;                                                                                                                                  
                                                                                                                                                                                                                                                                    
/*%update_history2(customer_table_snapshot_1);                                                                                            */
/*%update_history2(customer_table_snapshot_2);*/
%update_history2(customer_table_snapshot_3);                                                                                            
%update_history2(customer_table_snapshot_4);
%update_history2(customer_table_snapshot_5);  


data actual_result; 
	set historic_info_customers;
run; 

proc sort data=actual_result; 
	by customer_id segment_generation valid_from_date; 
run; 


/*--------------------------------------------------------------*/
/* Checking if the expected result is what we get */
/*--------------------------------------------------------------*/
 
/*comparing */
data expected_result;
	set expected_from_to_result;
run; 

data actual_result;
	set actual_result;
run; 

/*Row 3, 8 och 14 differ, WHY?*/
proc compare base=expected_result 
    compare=actual_result;
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;Any one know why the result is not as expected?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you see some possibilities to improve the code that is much appreciated as well.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2023 10:10:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-from-to-table-My-program-does-not-satisfy-the-test/m-p/881519#M348314</guid>
      <dc:creator>SasStatistics</dc:creator>
      <dc:date>2023-06-20T10:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a from_to table - My program does not satisfy the test case I built? What is the error?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-from-to-table-My-program-does-not-satisfy-the-test/m-p/881612#M348339</link>
      <description>&lt;P&gt;Is macro update_history2 meant to update rows where segment_generation = 'segment_generation_1' ?&amp;nbsp; Because that's what is happening.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2023 20:24:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-from-to-table-My-program-does-not-satisfy-the-test/m-p/881612#M348339</guid>
      <dc:creator>Daryl</dc:creator>
      <dc:date>2023-06-20T20:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a from_to table - My program does not satisfy the test case I built? What is the error?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-from-to-table-My-program-does-not-satisfy-the-test/m-p/881619#M348341</link>
      <description>&lt;P&gt;If you only want to update rows from segment generation 2, you could add the segment generation to the index.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql;                                                                                                                               &lt;BR /&gt;  create index idx2 on historic_info_customers(customer_ID,segment_generation,valid_to_date);                                                               &lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;%macro update_history2(snapshot);                                                                                                       &lt;BR /&gt;data historic_info_customers;                                                                                                           &lt;BR /&gt;  set &amp;amp;snapshot;                                                                                                                        &lt;BR /&gt;  valid_to_date='31dec9999'd;&lt;BR /&gt;  segment_generation = 'segment_generation_2';&lt;BR /&gt;  modify historic_info_customers key=idx2;                                                                                               &lt;BR /&gt;  if not _iorc_ then do;                                                                                                                &lt;BR /&gt;    if segment_belonging ne segment_generation_2 then do;                               &lt;BR /&gt;      valid_to_date=date-1;                                                                                                             &lt;BR /&gt;      replace;                                                                                                                          &lt;BR /&gt;      valid_from_date=date;                                                                                                             &lt;BR /&gt;      valid_to_date='31dec9999'd;                                                                                                       &lt;BR /&gt;      segment_generation='segment_generation_2';                                                                                        &lt;BR /&gt;      segment_belonging=segment_generation_2;                                                                                           &lt;BR /&gt;      output;                                                                                                                           &lt;BR /&gt;      end;                                                                                                                              &lt;BR /&gt;    end;                                                                                                                                &lt;BR /&gt;  else do;                                                                                                                              &lt;BR /&gt;    _error_=0;                                                                                                                          &lt;BR /&gt;    valid_from_date=date;                                                                                                               &lt;BR /&gt;    valid_to_date='31dec9999'd;                                                                                                         &lt;BR /&gt;    segment_generation='segment_generation_2';                                                                                          &lt;BR /&gt;    segment_belonging=segment_generation_2;                                                                                             &lt;BR /&gt;    output;                                                                                                                             &lt;BR /&gt;    end;                                                                                                                                &lt;BR /&gt;  run;                                                                                                                                  &lt;BR /&gt;%mend;             &lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2023 21:09:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-from-to-table-My-program-does-not-satisfy-the-test/m-p/881619#M348341</guid>
      <dc:creator>Daryl</dc:creator>
      <dc:date>2023-06-20T21:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a from_to table - My program does not satisfy the test case I built? What is the error?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-from-to-table-My-program-does-not-satisfy-the-test/m-p/881732#M348411</link>
      <description>&lt;P&gt;&lt;EM&gt;"Is macro update_history2 meant to update rows where segment_generation = 'segment_generation_1' ?"&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;No, it is not supposed to do that.&lt;/P&gt;
&lt;P&gt;How do you see that that is actually happening?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2023 15:30:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-from-to-table-My-program-does-not-satisfy-the-test/m-p/881732#M348411</guid>
      <dc:creator>SasStatistics</dc:creator>
      <dc:date>2023-06-21T15:30:43Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a from_to table - My program does not satisfy the test case I built? What is the error?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-from-to-table-My-program-does-not-satisfy-the-test/m-p/881751#M348420</link>
      <description>&lt;P&gt;See code suggestion above.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2023 17:08:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-from-to-table-My-program-does-not-satisfy-the-test/m-p/881751#M348420</guid>
      <dc:creator>Daryl</dc:creator>
      <dc:date>2023-06-21T17:08:45Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a from_to table - My program does not satisfy the test case I built? What is the error?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-from-to-table-My-program-does-not-satisfy-the-test/m-p/881883#M348456</link>
      <description>&lt;P&gt;This works, thanks.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Why does it not work to use the same thing for idx as for idx2?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;                                                                                                                               
  create index &lt;STRONG&gt;idx&lt;/STRONG&gt; on historic_info_customers(customer_ID,&lt;STRONG&gt;segment_generation&lt;/STRONG&gt;,valid_to_date);                                                               
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Jun 2023 12:27:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-from-to-table-My-program-does-not-satisfy-the-test/m-p/881883#M348456</guid>
      <dc:creator>SasStatistics</dc:creator>
      <dc:date>2023-06-22T12:27:26Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a from_to table - My program does not satisfy the test case I built? What is the error?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-from-to-table-My-program-does-not-satisfy-the-test/m-p/881907#M348464</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/381436"&gt;@SasStatistics&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;How do you see that that is actually happening?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;I ran your code by submitting it step by step.&amp;nbsp; When you run the 2nd macro for the first time on snapshot 3, and look at the resulting file, you can see that rows for segment 1 were modified.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2023 14:04:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-from-to-table-My-program-does-not-satisfy-the-test/m-p/881907#M348464</guid>
      <dc:creator>Daryl</dc:creator>
      <dc:date>2023-06-22T14:04:57Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a from_to table - My program does not satisfy the test case I built? What is the error?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-from-to-table-My-program-does-not-satisfy-the-test/m-p/881908#M348465</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/381436"&gt;@SasStatistics&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;This works, thanks.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Why does it not work to use the same thing for idx as for idx2?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;                                                                                                                               
  create index &lt;STRONG&gt;idx&lt;/STRONG&gt; on historic_info_customers(customer_ID,&lt;STRONG&gt;segment_generation&lt;/STRONG&gt;,valid_to_date);                                                               
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I imagine it could.&amp;nbsp; I just created an idx2 because you had previously created an index with the name idx.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2023 14:07:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-from-to-table-My-program-does-not-satisfy-the-test/m-p/881908#M348465</guid>
      <dc:creator>Daryl</dc:creator>
      <dc:date>2023-06-22T14:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a from_to table - My program does not satisfy the test case I built? What is the error?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-from-to-table-My-program-does-not-satisfy-the-test/m-p/881911#M348467</link>
      <description>&lt;P&gt;You can generalize your macro for multiple segments if there are going to be segments beyond the first two:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
%macro update_historyN(snapshot,segment);                                                                                                       
data historic_info_customers;                                                                                                           
  set &amp;amp;snapshot;                                                                                                                        
  valid_to_date='31dec9999'd;
  segment_generation = trim("segment_generation_&amp;amp;segment");
  modify historic_info_customers key=idx2;                                                                                               
  if not _iorc_ then do;                                                                                                                
    if segment_belonging ne segment_generation_&amp;amp;segment then do;                               
      valid_to_date=date-1;                                                                                                             
      replace;                                                                                                                          
      valid_from_date=date;                                                                                                             
      valid_to_date='31dec9999'd;                                                                                                       
      segment_generation=trim("segment_generation_&amp;amp;segment");                                                                                        
      segment_belonging=segment_generation_&amp;amp;segment;                                                                                           
      output;                                                                                                                           
      end;                                                                                                                              
    end;                                                                                                                                
  else do;                                                                                                                              
    _error_=0;                                                                                                                          
    valid_from_date=date;                                                                                                               
    valid_to_date='31dec9999'd;                                                                                                         
    segment_generation=trim("segment_generation_&amp;amp;segment");                                                                                          
    segment_belonging=segment_generation_&amp;amp;segment;                                                                                             
    output;                                                                                                                             
    end;                                                                                                                                
  run;                                                                                                                                  
%mend;          

data customer_table_snapshot_6;
   input date :yymmdd10. customer_id segment_generation_1 $  segment_generation_2 $ segment_generation_3 $;
   format date yymmdd10.;
   datalines;
   2023-09-27 111 A C D
   2023-09-27 222 C C E
   2023-09-27 333 B B F
   ;
run;
data customer_table_snapshot_7;
   input date :yymmdd10. customer_id segment_generation_1 $  segment_generation_2 $ segment_generation_3 $;
   format date yymmdd10.;
   datalines;
   2023-10-21 111 A C F
   2023-10-21 222 C C E
   2023-10-21 333 B B D
   ;
run;


%update_historyN(customer_table_snapshot_6,3);                                                                                            
%update_historyN(customer_table_snapshot_7,3);                                                                                            

data actual_result; 
	set historic_info_customers;
run; 

proc sort data=actual_result; 
	by customer_id segment_generation valid_from_date; 
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Jun 2023 14:29:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-from-to-table-My-program-does-not-satisfy-the-test/m-p/881911#M348467</guid>
      <dc:creator>Daryl</dc:creator>
      <dc:date>2023-06-22T14:29:42Z</dc:date>
    </item>
  </channel>
</rss>

