<?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: Repeating the same value for each category of dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Repeating-the-same-value-for-each-category-of-dates/m-p/618156#M181296</link>
    <description>&lt;P&gt;Thanks for quick reply. I run your code but still the same problem.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 17 Jan 2020 18:11:30 GMT</pubDate>
    <dc:creator>Bright</dc:creator>
    <dc:date>2020-01-17T18:11:30Z</dc:date>
    <item>
      <title>Repeating the same value for each category of dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Repeating-the-same-value-for-each-category-of-dates/m-p/618154#M181294</link>
      <description>&lt;P&gt;Hi, I am trying to repeat the same value for all similar dates.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My data looks like this, where first column is month and year and second column is a percentage:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;month-year&amp;nbsp; &amp;nbsp; &amp;nbsp; monthly-com&lt;/P&gt;&lt;P&gt;03M2015&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0.57&lt;/P&gt;&lt;P&gt;03M2015&lt;/P&gt;&lt;P&gt;03M2015&lt;/P&gt;&lt;P&gt;04M2015&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.63&lt;/P&gt;&lt;P&gt;04M2015&lt;/P&gt;&lt;P&gt;05M2015&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.73&lt;/P&gt;&lt;P&gt;05M2015&lt;/P&gt;&lt;P&gt;05M2015&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The values of second column should be repeated for all similar month-year. I tried the below code but it does not work. Anybody can help? Thanks!&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data outputData (drop=temp_Monthly_com temp_month_year); 
set have;
retain temp_Monthly_com . temp_month_year .; 
if temp_month_year ne month_year then do;
temp_month_year = month_year;
format temp_month_year MMYY.;
temp_Monthly_com = .;
end;

if Monthly_com = . then temp_Monthly_com=Monthly_com; 
else temp_Monthly_com = Monthly_com; 
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Jan 2020 18:02:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Repeating-the-same-value-for-each-category-of-dates/m-p/618154#M181294</guid>
      <dc:creator>Bright</dc:creator>
      <dc:date>2020-01-17T18:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: Repeating the same value for each category of dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Repeating-the-same-value-for-each-category-of-dates/m-p/618155#M181295</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards truncover;
input month_year $     monthly_com;
cards;
03M2015         0.57
03M2015
03M2015
04M2015        0.63
04M2015
05M2015        0.73
05M2015
05M2015
;

data want;
 update have(obs=0) have;
 by  month_year;
 output;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Jan 2020 18:08:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Repeating-the-same-value-for-each-category-of-dates/m-p/618155#M181295</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-01-17T18:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: Repeating the same value for each category of dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Repeating-the-same-value-for-each-category-of-dates/m-p/618156#M181296</link>
      <description>&lt;P&gt;Thanks for quick reply. I run your code but still the same problem.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 18:11:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Repeating-the-same-value-for-each-category-of-dates/m-p/618156#M181296</guid>
      <dc:creator>Bright</dc:creator>
      <dc:date>2020-01-17T18:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: Repeating the same value for each category of dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Repeating-the-same-value-for-each-category-of-dates/m-p/618160#M181298</link>
      <description>&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;retain monthly_com_filled;&lt;/P&gt;
&lt;P&gt;if not missing(monthly_com) then monthly_com_filled = monthly_com;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Replace Old with your old variable name and new with your new variable name.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 18:18:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Repeating-the-same-value-for-each-category-of-dates/m-p/618160#M181298</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-01-17T18:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: Repeating the same value for each category of dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Repeating-the-same-value-for-each-category-of-dates/m-p/618162#M181299</link>
      <description>&lt;P&gt;Not sure where is the discrepancy unless you post the log and the result you are getting. Here is my test and results&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards truncover;
input month_year $     monthly_com;
cards;
03M2015         0.57
03M2015
03M2015
04M2015        0.63
04M2015
05M2015        0.73
05M2015
05M2015
;

data want;
 update have(obs=0) have;
 by  month_year;
 output;
run;

proc print noobs;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set WORK.WANT" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="l header" scope="col"&gt;month_year&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;monthly_com&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;03M2015&lt;/TD&gt;
&lt;TD class="r data"&gt;0.57&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;03M2015&lt;/TD&gt;
&lt;TD class="r data"&gt;0.57&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;03M2015&lt;/TD&gt;
&lt;TD class="r data"&gt;0.57&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;04M2015&lt;/TD&gt;
&lt;TD class="r data"&gt;0.63&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;04M2015&lt;/TD&gt;
&lt;TD class="r data"&gt;0.63&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;05M2015&lt;/TD&gt;
&lt;TD class="r data"&gt;0.73&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;05M2015&lt;/TD&gt;
&lt;TD class="r data"&gt;0.73&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;05M2015&lt;/TD&gt;
&lt;TD class="r data"&gt;0.73&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Jan 2020 18:27:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Repeating-the-same-value-for-each-category-of-dates/m-p/618162#M181299</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-01-17T18:27:45Z</dc:date>
    </item>
    <item>
      <title>Re: Repeating the same value for each category of dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Repeating-the-same-value-for-each-category-of-dates/m-p/618163#M181300</link>
      <description>&lt;P&gt;Thanks a lot!&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 18:29:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Repeating-the-same-value-for-each-category-of-dates/m-p/618163#M181300</guid>
      <dc:creator>Bright</dc:creator>
      <dc:date>2020-01-17T18:29:39Z</dc:date>
    </item>
  </channel>
</rss>

