<?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: populate data to a column in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/populate-data-to-a-column/m-p/609715#M177512</link>
    <description>&lt;P&gt;HI&amp;nbsp;&lt;SPAN&gt;Jag,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;I use Macro to get six datasets and their&amp;nbsp;number of records are 3243, 4904, 4904, 3723, 4904,4904. What I need to do is populate these values to a new variable called "new_column" based on same month and year.&amp;nbsp;After that, I will derive a new variable by using variable CNT_terminate and new_column. But the thing is how to fill those values 3243, 4904, 4904, 3723, 4904,4904 into the variable new_column? Thanks a lot!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2019-12-05 at 10.25.08 AM.png" style="width: 436px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/34477i32697BDE4F0A2227/image-dimensions/436x331?v=v2" width="436" height="331" role="button" title="Screen Shot 2019-12-05 at 10.25.08 AM.png" alt="Screen Shot 2019-12-05 at 10.25.08 AM.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2019-12-05 at 10.23.48 AM.png" style="width: 362px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/34478i9CC7AE3822FA848F/image-dimensions/362x366?v=v2" width="362" height="366" role="button" title="Screen Shot 2019-12-05 at 10.23.48 AM.png" alt="Screen Shot 2019-12-05 at 10.23.48 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 05 Dec 2019 15:38:24 GMT</pubDate>
    <dc:creator>runrunrunbunny</dc:creator>
    <dc:date>2019-12-05T15:38:24Z</dc:date>
    <item>
      <title>populate data to a column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/populate-data-to-a-column/m-p/609598#M177493</link>
      <description>&lt;P&gt;HI&lt;/P&gt;&lt;P&gt;Does anyone know how to populate data to a newly added column?&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bunny&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2019-12-05 at 1.22.33 AM.png" style="width: 318px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/34471i3661388C38418FC3/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2019-12-05 at 1.22.33 AM.png" alt="Screen Shot 2019-12-05 at 1.22.33 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 06:32:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/populate-data-to-a-column/m-p/609598#M177493</guid>
      <dc:creator>runrunrunbunny</dc:creator>
      <dc:date>2019-12-05T06:32:25Z</dc:date>
    </item>
    <item>
      <title>Re: populate data to a column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/populate-data-to-a-column/m-p/609600#M177495</link>
      <description>&lt;P&gt;Please provide more details on how you want to derive the new variable we need to use the existing variables to derive the new column.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 06:37:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/populate-data-to-a-column/m-p/609600#M177495</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-12-05T06:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: populate data to a column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/populate-data-to-a-column/m-p/609715#M177512</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;SPAN&gt;Jag,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;I use Macro to get six datasets and their&amp;nbsp;number of records are 3243, 4904, 4904, 3723, 4904,4904. What I need to do is populate these values to a new variable called "new_column" based on same month and year.&amp;nbsp;After that, I will derive a new variable by using variable CNT_terminate and new_column. But the thing is how to fill those values 3243, 4904, 4904, 3723, 4904,4904 into the variable new_column? Thanks a lot!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2019-12-05 at 10.25.08 AM.png" style="width: 436px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/34477i32697BDE4F0A2227/image-dimensions/436x331?v=v2" width="436" height="331" role="button" title="Screen Shot 2019-12-05 at 10.25.08 AM.png" alt="Screen Shot 2019-12-05 at 10.25.08 AM.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2019-12-05 at 10.23.48 AM.png" style="width: 362px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/34478i9CC7AE3822FA848F/image-dimensions/362x366?v=v2" width="362" height="366" role="button" title="Screen Shot 2019-12-05 at 10.23.48 AM.png" alt="Screen Shot 2019-12-05 at 10.23.48 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 15:38:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/populate-data-to-a-column/m-p/609715#M177512</guid>
      <dc:creator>runrunrunbunny</dc:creator>
      <dc:date>2019-12-05T15:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: populate data to a column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/populate-data-to-a-column/m-p/609719#M177514</link>
      <description>&lt;P&gt;Please post code by copying from the editor and pasting into a code box opened on the forum with either the {I} or "running man" icon. That way we don't have to retype your code from scratch. (Hint: anything more than a very few lines are likely not to have anyone on this forum with the time or desire to do so.).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This should work&lt;/P&gt;
&lt;PRE&gt;%Macro active_account(cancel_date, active_customer);
   data work.___temp;
      set sd.active_1;
      if start_date le &amp;amp;cancel_date.;
   run;

   data &amp;amp;active_customer;
      set work.___temp nobs=nn;
      new_column=nn;
   run;
%mend;&lt;/PRE&gt;
&lt;P&gt;Any process that involves separating data into multiple sets is always suspect for reliability and scalability.&lt;/P&gt;
&lt;P&gt;You might be better off describing how this 'output' is used as you do not actually show any code that could possibly create the actual output you show.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 15:50:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/populate-data-to-a-column/m-p/609719#M177514</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-12-05T15:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: populate data to a column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/populate-data-to-a-column/m-p/609739#M177519</link>
      <description>&lt;P&gt;Thank you so much for you reply!&amp;nbsp;&lt;/P&gt;&lt;P&gt;sd.Tel_data is a whole dataset including both active and cancelled customers.Like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;customer_id &amp;nbsp; &amp;nbsp; &amp;nbsp;start_date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;cancel_date&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;8661 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 29APR2002 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 18APR2005&lt;/P&gt;&lt;P&gt;8662 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 20APR2000 &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;/P&gt;&lt;P&gt;8663 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 10May2003 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 18OCT2006&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;sd.active only contains active customers' information. Like this:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;customer_id &amp;nbsp; &amp;nbsp; &amp;nbsp;start_date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;cancel_date&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;8662 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 20APR2000 &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;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code blow is to figure out number of active customers each month:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;sd.active;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;set&lt;/SPAN&gt; sd.Tel_data&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; cancel_date EQ missing;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/SPAN&gt; active_account(input,output);&lt;/P&gt;&lt;P&gt;data &amp;amp;output;&lt;/P&gt;&lt;P&gt;set sd.active;&lt;/P&gt;&lt;P&gt;if start_date LE&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;amp;input;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;run;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;active_account&lt;/I&gt;&lt;/STRONG&gt;(&lt;SPAN&gt;&lt;STRONG&gt;'30APR2004'D&lt;/STRONG&gt;&lt;/SPAN&gt;, sd.active_APR2004);&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;active_account&lt;/I&gt;&lt;/STRONG&gt;(&lt;SPAN&gt;&lt;STRONG&gt;'30APR2005'D&lt;/STRONG&gt;&lt;/SPAN&gt;, sd.active_APR2005);&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;active_account&lt;/I&gt;&lt;/STRONG&gt;(&lt;SPAN&gt;&lt;STRONG&gt;'30APR2006'D&lt;/STRONG&gt;&lt;/SPAN&gt;, sd.active_APR2006);&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;active_account&lt;/I&gt;&lt;/STRONG&gt;(&lt;SPAN&gt;&lt;STRONG&gt;'30AUG2004'D&lt;/STRONG&gt;&lt;/SPAN&gt;, sd.active_AUG2004);&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;active_account&lt;/I&gt;&lt;/STRONG&gt;(&lt;SPAN&gt;&lt;STRONG&gt;'30AUG2005'D&lt;/STRONG&gt;&lt;/SPAN&gt;, sd.active_AUG2005);&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;active_account&lt;/I&gt;&lt;/STRONG&gt;(&lt;SPAN&gt;&lt;STRONG&gt;'30AUG2006'D&lt;/STRONG&gt;&lt;/SPAN&gt;, sd.active_AUG2006);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The dataset below called sd.Temo which contains information of cancelled customers. This dataset has variables like customer_id, start_date, cancel_date. (sd.Temo is also subsetted from whole dataset sd.Tel_data)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;customer_id &amp;nbsp; &amp;nbsp; &amp;nbsp;start_date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;cancel_date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CNT_terminate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;8661 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 29APR2002 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 18APR2005 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 154&lt;/P&gt;&lt;P&gt;8663 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 10May2003 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 18OCT2006 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 142&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I need to do is to derive a new variable called "CNT_active " which means number of active customers each month in dataset&amp;nbsp; sd.Temo, and populate the results of&amp;nbsp;active customers each month I got from Macro above to new column&amp;nbsp;CNT_active. Like this:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;customer_id &amp;nbsp; &amp;nbsp; &amp;nbsp;start_date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;cancel_date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CNT_terminate &amp;nbsp; &amp;nbsp; CNT_active&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;8661 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 29APR2002 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 18APR2005 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 154 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3733&lt;/P&gt;&lt;P&gt;8663 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 10May2003 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 18OCT2006 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 142 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4890&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sd.active and sd.Temo don't have any common key variables such as customer_id because one table is for active customers and the other is for cancelled customers, they are not overlapping.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please give me some advice? Thanks a lot!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 17:19:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/populate-data-to-a-column/m-p/609739#M177519</guid>
      <dc:creator>runrunrunbunny</dc:creator>
      <dc:date>2019-12-05T17:19:09Z</dc:date>
    </item>
    <item>
      <title>derive and populate data in a new dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/populate-data-to-a-column/m-p/609776#M177555</link>
      <description>&lt;P&gt;&lt;FONT size="3"&gt;&lt;SPAN&gt;Hi, here's the description of my question. Thanks in advance&amp;nbsp;&lt;/SPAN&gt;everyone!!!&lt;/FONT&gt;&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;&lt;SPAN&gt;sd.Tel_data is a whole dataset including information of both active and cancelled customers.Like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;customer_id &amp;nbsp; &amp;nbsp; &amp;nbsp;start_date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;cancel_date&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;8661 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 29APR2002 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 30APR2004&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;8662 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 20APR2000 &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;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;8663 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 10May2003 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 30APR2005&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;sd.active is subsetted from sd.Tel_data, which only contains active customers' information. Like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;customer_id &amp;nbsp; &amp;nbsp; &amp;nbsp;start_date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;cancel_date&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;8662 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 20APR2000 &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;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The code blow is to figure out number of active customers each month:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;sd.active;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;set sd.Tel_data&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if cancel_date EQ missing;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt; active_account(input, output);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;data &amp;amp;output;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;set sd.active;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if start_date LE&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;amp;input;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;run;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%&lt;STRONG&gt;&lt;I&gt;active_account&lt;/I&gt;&lt;/STRONG&gt;(&lt;STRONG&gt;'30APR2004'D&lt;/STRONG&gt;, sd.active_APR2004);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%&lt;STRONG&gt;&lt;I&gt;active_account&lt;/I&gt;&lt;/STRONG&gt;(&lt;STRONG&gt;'30APR2005'D&lt;/STRONG&gt;, sd.active_APR2005);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%&lt;STRONG&gt;&lt;I&gt;active_account&lt;/I&gt;&lt;/STRONG&gt;(&lt;STRONG&gt;'30APR2006'D&lt;/STRONG&gt;, sd.active_APR2006);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%&lt;STRONG&gt;&lt;I&gt;active_account&lt;/I&gt;&lt;/STRONG&gt;(&lt;STRONG&gt;'30AUG2004'D&lt;/STRONG&gt;, sd.active_AUG2004);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%&lt;STRONG&gt;&lt;I&gt;active_account&lt;/I&gt;&lt;/STRONG&gt;(&lt;STRONG&gt;'30AUG2005'D&lt;/STRONG&gt;, sd.active_AUG2005);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%&lt;STRONG&gt;&lt;I&gt;active_account&lt;/I&gt;&lt;/STRONG&gt;(&lt;STRONG&gt;'30AUG2006'D&lt;/STRONG&gt;, sd.active_AUG2006);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&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;&lt;SPAN&gt;The dataset below called sd.Temo which contains information of cancelled customers. This dataset has variables like customer_id, start_date, cancel_date. (sd.Temo is also subsetted from whole dataset sd.Tel_data)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;customer_id &amp;nbsp; &amp;nbsp; &amp;nbsp;start_date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;cancel_date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CNT_terminate&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;8661 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 29APR2002 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 30APR2004 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 154&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;8663 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 10May2003 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 30APR2005 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;142&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;What I need to do is to derive a new variable called &lt;/SPAN&gt;&lt;FONT color="#FF0000"&gt;&lt;SPAN&gt;CNT_active&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt; which means number of active customers each month in dataset&amp;nbsp; sd.Temo, and populate the results of&amp;nbsp;number of active customers each month I got from Macro above to new column&amp;nbsp;&lt;FONT color="#FF0000"&gt;CNT_active&lt;/FONT&gt;. My purpose is calculate churn rate using CNT_terminate divided&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;by CNT_active if these two variables are in a same dataset. Like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;customer_id &amp;nbsp; &amp;nbsp; &amp;nbsp;start_date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;cancel_date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CNT_terminate &amp;nbsp; &amp;nbsp; &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;CNT_active&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;8661 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;29APR2002 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 30APR2004 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 154 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;3243&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;8663 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;10May2003 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 30APR2005 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;142 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;4904&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;sd.active and sd.Temo don't have any common key variables such as customer_id because one table is for active customers and the other is for cancelled customers, they are not overlapping.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But how to derive the new variable &lt;/SPAN&gt;&lt;SPAN&gt;&lt;FONT color="#FF0000"&gt;CNT_active&lt;/FONT&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;in dataset sd.Temo and populate the results from Macro which are 3243, 4904, 4904,3723, 4904, 4904 into variable &lt;/SPAN&gt;&lt;SPAN&gt;&lt;FONT color="#FF0000"&gt;CNT_active&lt;/FONT&gt; based on same month and year?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the results from Macro above:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2019-12-05 at 1.54.11 PM.png" style="width: 562px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/34481iE601B2F874599579/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2019-12-05 at 1.54.11 PM.png" alt="Screen Shot 2019-12-05 at 1.54.11 PM.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 19:01:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/populate-data-to-a-column/m-p/609776#M177555</guid>
      <dc:creator>runrunrunbunny</dc:creator>
      <dc:date>2019-12-05T19:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: populate data to a column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/populate-data-to-a-column/m-p/609781#M177542</link>
      <description>&lt;P&gt;Can you describe or show how you intend to use that data? Or what the question to answer with this process might be?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It really doesn't make a lot of sense to me why you are attaching a count of all active customers to each customer record of inactive customers?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 19:27:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/populate-data-to-a-column/m-p/609781#M177542</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-12-05T19:27:14Z</dc:date>
    </item>
    <item>
      <title>Re: derive and populate data in a new dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/populate-data-to-a-column/m-p/609784#M177556</link>
      <description>I created a calendar dataset with one record per day (because a table like that is useful in so many ways) and then I can join to it using start_date            and cancel_date.</description>
      <pubDate>Thu, 05 Dec 2019 19:35:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/populate-data-to-a-column/m-p/609784#M177556</guid>
      <dc:creator>tomrvincent</dc:creator>
      <dc:date>2019-12-05T19:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: derive and populate data in a new dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/populate-data-to-a-column/m-p/609785#M177557</link>
      <description>Look at the vtable table in sashelp dictionary. It has the Ns you want, so if you use a naming convention in your data set names you can easily pull that out. However, I would consider rewriting this from scratch to actually calculate what you want, which is easier.</description>
      <pubDate>Thu, 05 Dec 2019 19:39:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/populate-data-to-a-column/m-p/609785#M177557</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-12-05T19:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: populate data to a column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/populate-data-to-a-column/m-p/609790#M177547</link>
      <description>&lt;P&gt;Hi ballardw, my&lt;SPAN&gt;&amp;nbsp;purpose is calculate churn rate using CNT_terminate divided&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;by CNT_active if these two variables are in a same dataset. Like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;customer_id &amp;nbsp; &amp;nbsp; &amp;nbsp;start_date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;cancel_date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CNT_terminate &amp;nbsp; &amp;nbsp; &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;CNT_active&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;8661 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;29APR2002 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 30APR2004 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 154 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;3243&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;8663 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;10May2003 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 30APR2005 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;142 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;4904&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 19:51:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/populate-data-to-a-column/m-p/609790#M177547</guid>
      <dc:creator>runrunrunbunny</dc:creator>
      <dc:date>2019-12-05T19:51:58Z</dc:date>
    </item>
  </channel>
</rss>

