<?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: Collapsing rows into one row and overwriting a column in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Collapsing-rows-into-one-row-and-overwriting-a-column/m-p/867685#M342704</link>
    <description>&lt;P&gt;sure! I meant to only work with employee begin dates that started in 2023. Sorry for the confusion! I wanted to keep the most recent observation, it has an end date of&amp;nbsp; 31-dec-99, but insert the earliest date that started in 2023 for the employee as the begin date for that row.&lt;/P&gt;</description>
    <pubDate>Sun, 02 Apr 2023 23:32:00 GMT</pubDate>
    <dc:creator>BrinaLi</dc:creator>
    <dc:date>2023-04-02T23:32:00Z</dc:date>
    <item>
      <title>Collapsing rows into one row and overwriting a column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Collapsing-rows-into-one-row-and-overwriting-a-column/m-p/867627#M342674</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working with a dataset that has employee start and end dates. I want to collapse this employ table into one current row and overwrite the beginning date with the first date provided of the year in the begin_date column&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a picture of what I'd like to do:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BrinaLi_0-1680419946752.png" style="width: 541px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/82249iFED36D4CBFFF435C/image-dimensions/541x322?v=v2" width="541" height="322" role="button" title="BrinaLi_0-1680419946752.png" alt="BrinaLi_0-1680419946752.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working with over a million rows and would like to narrow it down to 2023, but hoping to be able to use this same code going into future years.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone suggest how to do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Apr 2023 07:22:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Collapsing-rows-into-one-row-and-overwriting-a-column/m-p/867627#M342674</guid>
      <dc:creator>BrinaLi</dc:creator>
      <dc:date>2023-04-02T07:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: Collapsing rows into one row and overwriting a column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Collapsing-rows-into-one-row-and-overwriting-a-column/m-p/867630#M342676</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let year = 2023;

data want;
set have;
by employee_id;
retain _start;
if first.employee_id then _start = .;
if _start =. and year(begin_date) = &amp;amp;year. then _start = begin_date;
if last.employee_id;
if _start ne . then begin_date = _start;
drop _start;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 02 Apr 2023 08:02:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Collapsing-rows-into-one-row-and-overwriting-a-column/m-p/867630#M342676</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-04-02T08:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: Collapsing rows into one row and overwriting a column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Collapsing-rows-into-one-row-and-overwriting-a-column/m-p/867644#M342685</link>
      <description>&lt;P&gt;Can you explain what "&lt;SPAN&gt;narrow it down to 2023" means?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Do you want to only keep the observations where the end_date is greater than '01JAN2023'd ?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Or did you have some other interpretation in mind?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Apr 2023 15:45:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Collapsing-rows-into-one-row-and-overwriting-a-column/m-p/867644#M342685</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-04-02T15:45:59Z</dc:date>
    </item>
    <item>
      <title>Re: Collapsing rows into one row and overwriting a column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Collapsing-rows-into-one-row-and-overwriting-a-column/m-p/867684#M342703</link>
      <description>&lt;P&gt;thank you! this worked!!!&lt;/P&gt;</description>
      <pubDate>Sun, 02 Apr 2023 23:29:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Collapsing-rows-into-one-row-and-overwriting-a-column/m-p/867684#M342703</guid>
      <dc:creator>BrinaLi</dc:creator>
      <dc:date>2023-04-02T23:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: Collapsing rows into one row and overwriting a column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Collapsing-rows-into-one-row-and-overwriting-a-column/m-p/867685#M342704</link>
      <description>&lt;P&gt;sure! I meant to only work with employee begin dates that started in 2023. Sorry for the confusion! I wanted to keep the most recent observation, it has an end date of&amp;nbsp; 31-dec-99, but insert the earliest date that started in 2023 for the employee as the begin date for that row.&lt;/P&gt;</description>
      <pubDate>Sun, 02 Apr 2023 23:32:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Collapsing-rows-into-one-row-and-overwriting-a-column/m-p/867685#M342704</guid>
      <dc:creator>BrinaLi</dc:creator>
      <dc:date>2023-04-02T23:32:00Z</dc:date>
    </item>
  </channel>
</rss>

