<?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: How to insert a Holiday value into week period that contains holiday ? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-insert-a-Holiday-value-into-week-period-that-contains/m-p/399189#M96665</link>
    <description>&lt;P&gt;Are your dates SAS date valued variables or character variables?&lt;/P&gt;</description>
    <pubDate>Wed, 27 Sep 2017 14:33:46 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-09-27T14:33:46Z</dc:date>
    <item>
      <title>How to insert a Holiday value into week period that contains holiday ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-insert-a-Holiday-value-into-week-period-that-contains/m-p/399179#M96660</link>
      <description>&lt;P&gt;Dear SAS User community:&lt;/P&gt;
&lt;P&gt;I have two datasets: one is Holiday and another is detail data with week period.&lt;BR /&gt;Example: Holiday dataset (two vars which contain Holiday date in a year of 2017):&lt;/P&gt;
&lt;P&gt;Holiday&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Holiday_DESC&lt;BR /&gt;...&lt;BR /&gt;04-JUL-17&amp;nbsp; &amp;nbsp; &amp;nbsp;Independent Day&lt;BR /&gt;04-SEP-17&amp;nbsp; &amp;nbsp; Labor Day&lt;BR /&gt;....&lt;/P&gt;
&lt;P&gt;Detail dataset (various vars that contain start-week and end-week)&lt;BR /&gt;* comment: start-week starts at Sunday&lt;/P&gt;
&lt;P&gt;........ start_week end_week&lt;BR /&gt;....... 02-JUL-17 08-JUL-17&lt;BR /&gt;....... 09-JUL-17 15-JUL-17&lt;BR /&gt;........&lt;BR /&gt;........ 03-SEP-17 09-SEP-17&lt;/P&gt;
&lt;P&gt;MY question is:&lt;/P&gt;
&lt;P&gt;How to write sas codes to insert one var with 'HOL' value into week period that contains Holiday&lt;BR /&gt;and other week periods still blank ?&lt;/P&gt;
&lt;P&gt;I want the result:&lt;/P&gt;
&lt;P&gt;(vars) start_week&amp;nbsp; &amp;nbsp;end_week&amp;nbsp; &amp;nbsp; &amp;nbsp; Holiday (new var)&lt;BR /&gt;.......&amp;nbsp; &amp;nbsp; 02-JUL-17&amp;nbsp; 08-JUL-17&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'HOL'&lt;BR /&gt;.......&amp;nbsp; &amp;nbsp; 09-JUL-17&amp;nbsp; 15-JUL-17 &lt;BR /&gt;........&lt;BR /&gt;........&amp;nbsp; &amp;nbsp;03-SEP-17&amp;nbsp; 09-SEP-17&amp;nbsp; &amp;nbsp; &amp;nbsp; 'HOL'&lt;/P&gt;
&lt;P&gt;Thanks for your instruction.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;WT196838&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2017 14:19:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-insert-a-Holiday-value-into-week-period-that-contains/m-p/399179#M96660</guid>
      <dc:creator>wtien196838</dc:creator>
      <dc:date>2017-09-27T14:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert a Holiday value into week period that contains holiday ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-insert-a-Holiday-value-into-week-period-that-contains/m-p/399189#M96665</link>
      <description>&lt;P&gt;Are your dates SAS date valued variables or character variables?&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2017 14:33:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-insert-a-Holiday-value-into-week-period-that-contains/m-p/399189#M96665</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-09-27T14:33:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert a Holiday value into week period that contains holiday ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-insert-a-Holiday-value-into-week-period-that-contains/m-p/399196#M96669</link>
      <description>&lt;P&gt;It is character variable on date field.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2017 14:45:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-insert-a-Holiday-value-into-week-period-that-contains/m-p/399196#M96669</guid>
      <dc:creator>wtien196838</dc:creator>
      <dc:date>2017-09-27T14:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert a Holiday value into week period that contains holiday ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-insert-a-Holiday-value-into-week-period-that-contains/m-p/399260#M96692</link>
      <description>&lt;P&gt;Assuming your dates are true SAS date values, and that both datasets are sorted chronologically, you can pre-read the HOLIDAY dataset and generate corresponding START_DATE values.&amp;nbsp; Then merge with the WEEKS dataset:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data need / view=need;
  set holiday;
  start_date=intnx('week',holiday,0,'beg');
run;

data want;
  merge weeks need;
  by start_date;
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note this assume all weeks begin on Sunday.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2017 16:48:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-insert-a-Holiday-value-into-week-period-that-contains/m-p/399260#M96692</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-09-27T16:48:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert a Holiday value into week period that contains holiday ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-insert-a-Holiday-value-into-week-period-that-contains/m-p/400847#M97172</link>
      <description>&lt;P&gt;Thanks mkeintz. Your suggestion directs me to get the solution of my problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your effort.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;WT196838&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2017 01:17:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-insert-a-Holiday-value-into-week-period-that-contains/m-p/400847#M97172</guid>
      <dc:creator>wtien196838</dc:creator>
      <dc:date>2017-10-04T01:17:20Z</dc:date>
    </item>
  </channel>
</rss>

