<?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 find all observations after first. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-all-observations-after-first/m-p/721448#M223612</link>
    <description>Thank you so much. I tried so many if then statements, and could not figure it out. It is way simpler than i imagined. Much appreciated.</description>
    <pubDate>Wed, 24 Feb 2021 01:57:49 GMT</pubDate>
    <dc:creator>jude1</dc:creator>
    <dc:date>2021-02-24T01:57:49Z</dc:date>
    <item>
      <title>How to find all observations after first.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-all-observations-after-first/m-p/721432#M223603</link>
      <description>&lt;P&gt;I'm new to sas, and trying to learn. In an exercise I'm doing, I'm given ID, date, suger level in my data. i am asked to Output all observations after the first for each person to a dataset. Do i use an if then else statement?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, how do i output&amp;nbsp;all observations for patients with only one record to a dataset&lt;/P&gt;&lt;P&gt;Here is my code for first which i figured. I just can not figure out the code for observations after the first:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc import&lt;BR /&gt;datafile='patient2.xlsx'&lt;BR /&gt;dbms=xlsx replace out=patients;&lt;BR /&gt;sheet="Sheet1"; getnames=yes;&lt;BR /&gt;proc sort data=patients; by patient date;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data patientsObs;&lt;BR /&gt;set patients; by patient Date;&lt;BR /&gt;if first.patient then output;&lt;BR /&gt;rename suger = firstobs;&lt;/P&gt;&lt;P&gt;proc print data=patientsObs;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 00:39:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-all-observations-after-first/m-p/721432#M223603</guid>
      <dc:creator>jude1</dc:creator>
      <dc:date>2021-02-24T00:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to find all observations after first.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-all-observations-after-first/m-p/721446#M223610</link>
      <description>&lt;P&gt;Hope the below helps:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Read the object spawner log */
data have;
	input patient $ date date9. s_level;
	format date date9.;
	datalines;
01 01jan2021 7
01 05jan2021 8
01 14jan2021 7
02 01jan2021 7
02 04jan2021 6
02 28jan2021 10
02 29jan2021 12
03 01feb2021 2
03 02feb2021 6
;
run;

proc sort data=have;
	by patient date;
run;

data want;
	set have;
	by patient date;

	if ^first.patient then
		output;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Feb 2021 01:38:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-all-observations-after-first/m-p/721446#M223610</guid>
      <dc:creator>qoit</dc:creator>
      <dc:date>2021-02-24T01:38:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to find all observations after first.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-all-observations-after-first/m-p/721448#M223612</link>
      <description>Thank you so much. I tried so many if then statements, and could not figure it out. It is way simpler than i imagined. Much appreciated.</description>
      <pubDate>Wed, 24 Feb 2021 01:57:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-all-observations-after-first/m-p/721448#M223612</guid>
      <dc:creator>jude1</dc:creator>
      <dc:date>2021-02-24T01:57:49Z</dc:date>
    </item>
  </channel>
</rss>

