<?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: Selecting several first and last values of variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Selecting-several-first-and-last-values-of-variables/m-p/403148#M97954</link>
    <description>It has worked! Thank you very much!</description>
    <pubDate>Wed, 11 Oct 2017 13:10:30 GMT</pubDate>
    <dc:creator>DmytroYermak</dc:creator>
    <dc:date>2017-10-11T13:10:30Z</dc:date>
    <item>
      <title>Selecting several first and last values of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selecting-several-first-and-last-values-of-variables/m-p/403106#M97941</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please advise how to manage the following case. I have to select the values FLAG1 and FLAG2 from the first line of the group and FLAG3 and IDENT from the last line. Could you please advise a compact algorythm? The sample code is attached.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&amp;nbsp;&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="1.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/15776i2BBF7B964E6E327A/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.jpg" alt="1.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
	infile datalines dlm='/';
	input FLAG1 : $1. FLAG2 : $1. FLAG3 : $1. IDENT : $7.;
datalines;
Y	/	N	/		/	ABC-101
N	/	N	/		/	ABC-101
N	/	N	/	Y	/	ABC-101
Y	/	N	/		/	ABC-102
N	/	N	/		/	ABC-102
N	/	N	/		/	ABC-102
N	/	N	/		/	ABC-102
N	/	N	/		/	ABC-103
N	/	N	/		/	ABC-103
N	/	N	/		/	ABC-103
N	/	N	/	N	/	ABC-103

;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2017 11:51:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selecting-several-first-and-last-values-of-variables/m-p/403106#M97941</guid>
      <dc:creator>DmytroYermak</dc:creator>
      <dc:date>2017-10-11T11:51:32Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting several first and last values of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selecting-several-first-and-last-values-of-variables/m-p/403116#M97944</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
	set test;
	by IDENT;
	array FLAGS(2) $1. _TEMPORARY_;

	if first.IDENT then do;
		FLAGS(1)=FLAG1;
		FLAGS(2)=FLAG2;
	end;

	if last.IDENT then do;
		FLAG1=FLAGS(1);
		FLAG2=FLAGS(2);
		output;
	end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Oct 2017 12:07:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selecting-several-first-and-last-values-of-variables/m-p/403116#M97944</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2017-10-11T12:07:33Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting several first and last values of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selecting-several-first-and-last-values-of-variables/m-p/403148#M97954</link>
      <description>It has worked! Thank you very much!</description>
      <pubDate>Wed, 11 Oct 2017 13:10:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selecting-several-first-and-last-values-of-variables/m-p/403148#M97954</guid>
      <dc:creator>DmytroYermak</dc:creator>
      <dc:date>2017-10-11T13:10:30Z</dc:date>
    </item>
  </channel>
</rss>

