<?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 set first observation to equal last observation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585070#M166779</link>
    <description>&lt;P&gt;When I do this my variables changes "treatment A" or "Treatment B" to "yes" or "no" and it is not consistent with which treatment group is yes or no (meaning treatment group A is not always yes). Did I incorrectly apply the code? Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;do _n_=1 by 1 until(last.study_id);&lt;BR /&gt;set have;&lt;BR /&gt;by study_id;&lt;BR /&gt;if _n_=2 then _temp=rand_group;;&lt;BR /&gt;end;&lt;BR /&gt;do _n_=1 to _n_;&lt;BR /&gt;set haveS;&lt;BR /&gt;by study_id;&lt;BR /&gt;if _n_=1 then rand_group=_temp;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Thu, 29 Aug 2019 19:57:34 GMT</pubDate>
    <dc:creator>GS2</dc:creator>
    <dc:date>2019-08-29T19:57:34Z</dc:date>
    <item>
      <title>How to set first observation to equal last observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/583574#M166129</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using SAS 9.4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have long data where a patient with study id of 1 has 8 rows. In the last row is a populated variable 'failure' and I need to get the yes/no from the last study id to populate into the first study id record. The middle rows are not important just being able to get the information from the last row into the first row. Is their a method to do this in SAS? Thank you for the help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Study ID&amp;nbsp; &amp;nbsp; &amp;nbsp; Failure&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&amp;nbsp;&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Yes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 17:59:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/583574#M166129</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2019-08-23T17:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to set first observation to equal last observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/583579#M166130</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/194348"&gt;@GS2&lt;/a&gt;&amp;nbsp; &amp;nbsp;Do you have a date/datetime variable to help us remerge?&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 18:17:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/583579#M166130</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-08-23T18:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to set first observation to equal last observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/583580#M166131</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;Yes I have a study date variable that is on the first row&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 18:18:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/583580#M166131</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2019-08-23T18:18:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to set first observation to equal last observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/583582#M166132</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input StudyID      Failure $;
cards;
1                  .
1                  .
1                  . 
1                  Yes
;

data want;
 do _n_=1 by 1 until(last.studyid);
  set have;
  by studyid;
  if last.studyid then _temp=failure;
 end;
 do _n_=1 to _n_;
  set have;
  by studyid;
  if _n_=1 then failure=_temp;
  output;
 end;
 drop _:;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 Aug 2019 18:31:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/583582#M166132</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-08-23T18:31:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to set first observation to equal last observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585046#M166766</link>
      <description>&lt;P&gt;Is their a method to do this same type procedure but to move the information from the second row into the first row? Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2019 19:17:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585046#M166766</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2019-08-29T19:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to set first observation to equal last observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585048#M166767</link>
      <description>&lt;P&gt;Do you mean , should the sample be&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; have&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt; StudyID      Failure &lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token datalines"&gt;&lt;SPAN class="token keyword"&gt;cards&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;SPAN class="token data string"&gt;
1                  .
1                  blah
1                  . 
1                  Yes
&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Requirement :&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; want&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt; StudyID      Failure &lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token datalines"&gt;&lt;SPAN class="token keyword"&gt;cards&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;SPAN class="token data string"&gt;
1                  blah
1                  blah
1                  . 
1                  Yes
&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;?&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2019 19:19:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585048#M166767</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-08-29T19:19:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to set first observation to equal last observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585053#M166768</link>
      <description>&lt;P&gt;Yes exactly moving the information from row 2 into row 1&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2019 19:24:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585053#M166768</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2019-08-29T19:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to set first observation to equal last observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585056#M166770</link>
      <description>&lt;P&gt;Change this&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt; &lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; last&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;studyid &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; _temp&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;failure&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/LI-CODE&gt;
&lt;P&gt;to&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if _n_=2 then _temp=failure;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2019 19:27:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585056#M166770</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-08-29T19:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to set first observation to equal last observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585070#M166779</link>
      <description>&lt;P&gt;When I do this my variables changes "treatment A" or "Treatment B" to "yes" or "no" and it is not consistent with which treatment group is yes or no (meaning treatment group A is not always yes). Did I incorrectly apply the code? Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;do _n_=1 by 1 until(last.study_id);&lt;BR /&gt;set have;&lt;BR /&gt;by study_id;&lt;BR /&gt;if _n_=2 then _temp=rand_group;;&lt;BR /&gt;end;&lt;BR /&gt;do _n_=1 to _n_;&lt;BR /&gt;set haveS;&lt;BR /&gt;by study_id;&lt;BR /&gt;if _n_=1 then rand_group=_temp;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2019 19:57:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585070#M166779</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2019-08-29T19:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to set first observation to equal last observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585072#M166781</link>
      <description>&lt;P&gt;Hmm This is the reason we need a &lt;STRONG&gt;&lt;EM&gt;good representative&lt;/EM&gt; &lt;/STRONG&gt;sample of&lt;/P&gt;
&lt;P&gt;1. HAVE&lt;/P&gt;
&lt;P&gt;2. WANT&lt;/P&gt;
&lt;P&gt;3. Brief explanation of the logic.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Take your time, get the requirement in full and let me know. It's SAS. So chill !&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2019 20:01:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585072#M166781</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-08-29T20:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to set first observation to equal last observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585169#M166824</link>
      <description>&lt;P&gt;Using SAS 9.4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My data looks as follows&lt;/P&gt;&lt;P&gt;study_ID&amp;nbsp; DOB&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;screening_date Rand_group&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MMDDYY10.&amp;nbsp; &amp;nbsp; &amp;nbsp; MMDDYY10.&amp;nbsp; &amp;nbsp; &amp;nbsp;.&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Group A&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From this data I want to have the information from the Rand_group variable in row 2 moved into row 1 so I can run a frequency of this information along with other demographics that are in the data set on only the top row. Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2019 11:42:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585169#M166824</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2019-08-30T11:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to set first observation to equal last observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585176#M166830</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input studyID $ DOB   :mmddyy10. screening_date :mmddyy10. Rand_group &amp;amp; $;
format dob screening_date mmddyy10.;
cards;
1             06202000      06202018     .
1              .                           .                         Group A
1              .                           .                         .
;
/*If you know the value exists in the 2nd record of the by group, you can look up, copy and*/
/*plug in the 1st like below which is the same what we discussed earlier.*/
data want;
 do _n_=1 by 1 until(last.studyid);
  set have;
  by studyid;
  if _n_=2 then _temp=Rand_group;
 end;
 do _n_=1 to _n_;
  set have;
  by studyid;
  if _n_=1 then Rand_group=_temp;
  output;
 end;
 drop _:;
run;

/*If you do NOT know which record of the BY_GROUP has the non-missing value, you could search for*/
/*non missing, pick and plug in 1st like below*/

data want;
 do _n_=1 by 1 until(last.studyid);
  set have;
  by studyid;
  if not missing(Rand_group) then _temp=Rand_group;
 end;
 do _n_=1 to _n_;
  set have;
  by studyid;
  if _n_=1 then Rand_group=_temp;
  output;
 end;
 drop _:;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Aug 2019 12:14:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585176#M166830</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-08-30T12:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to set first observation to equal last observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585182#M166832</link>
      <description>&lt;P&gt;I know the non-missing rand_group variable is always in the second row and so I copy and pasted the code and ran it. My results look as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;study_ID&amp;nbsp; DOB&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;screening_date Rand_group&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MMDDYY10.&amp;nbsp; &amp;nbsp; &amp;nbsp; MMDDYY10.&amp;nbsp; &amp;nbsp; &amp;nbsp;Yes&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Group A&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So instead of populating "Group A" I am getting a "Yes" or "No". The "Yes" however is not consistently only "Group A" or it would be fine. I am getting "Yes" for Group A and Group B and getting a "No" for Group A and Group B.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2019 12:36:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585182#M166832</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2019-08-30T12:36:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to set first observation to equal last observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585185#M166834</link>
      <description>&lt;P&gt;I can't see any YES or NO in your sample HAVE(Input)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your sample is&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; have&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt; studyID &lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt; DOB   :mmddyy10&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt; screening_date :mmddyy10&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt; Rand_group &lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;format&lt;/SPAN&gt; dob screening_date mmddyy10&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token datalines"&gt;&lt;SPAN class="token keyword"&gt;cards&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;SPAN class="token data string"&gt;
1             06202000      06202018     .
1              .                           .                         Group A
1              .                           .                         .
&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Are you sure you are testing &lt;EM&gt;&lt;STRONG&gt;against the correct input sample&lt;/STRONG&gt;&lt;/EM&gt;?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please verify what's in your input sample, and if you are testing against the sample and expecting the correct result&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2019 12:41:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585185#M166834</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-08-30T12:41:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to set first observation to equal last observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585187#M166835</link>
      <description>&lt;P&gt;That is where my confusion is coming from because their is not a Yes/No anywhere in the rand_group column. I am using the same dataset in my 'set' statements so I am not sure what is happening. Thank you for your help though!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2019 12:48:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585187#M166835</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2019-08-30T12:48:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to set first observation to equal last observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585190#M166836</link>
      <description>&lt;P&gt;You really need tor review your SET statement dataset calls&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Play with some values to see distinct values&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc sql;

select distinct rand_group

from have;

quit;



/*or a */

proc freq data=have;

tables&amp;nbsp;rand_group;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The above will give you an idea what's in your dataset to eventually know what to expect&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2019 12:55:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585190#M166836</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-08-30T12:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to set first observation to equal last observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585192#M166838</link>
      <description>&lt;DIV class="branch"&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;This is the output from the proc freq of the data set I am using in the set statement&lt;/DIV&gt;&lt;DIV align="center"&gt;&lt;P&gt;rand_group Frequency Percent Frequency Percent&lt;BR /&gt;Treatment A&amp;nbsp; 27&amp;nbsp; 50.94&amp;nbsp; 27&amp;nbsp; 50.94&lt;BR /&gt;Treatment B&amp;nbsp; 26&amp;nbsp; 49.06&amp;nbsp; &amp;nbsp;53&amp;nbsp; 100.00&lt;/P&gt;&lt;P&gt;Frequency Missing = 477&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 30 Aug 2019 13:02:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585192#M166838</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2019-08-30T13:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to set first observation to equal last observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585195#M166839</link>
      <description>&lt;P&gt;Ok so I suppose you got the same for&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc sql;&lt;/P&gt;
&lt;P&gt;select distinct rand_group&lt;/P&gt;
&lt;P&gt;from have&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In that case , you are definitely not referencing the correct dataset that picks yes/no from mars or moon lol&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2019 13:09:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585195#M166839</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-08-30T13:09:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to set first observation to equal last observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585200#M166841</link>
      <description>&lt;P&gt;Proc sql;&lt;/P&gt;&lt;P&gt;select distinct rand_group&lt;/P&gt;&lt;P&gt;from SPIES.SPIES_ANALYSIS_DEMOS&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc freq data =&amp;nbsp;SPIES.SPIES_ANALYSIS_DEMOS;&lt;/P&gt;&lt;P&gt;table rand_group;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Both show only treatment group a and b&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data SPIES_ANALYSIS_DEMOS2;&lt;BR /&gt;do _n_=1 by 1 until(last.study_id);&lt;BR /&gt;set SPIES.SPIES_ANALYSIS_DEMOS;&lt;BR /&gt;by study_id;&lt;BR /&gt;if _n_=2 then _temp=Rand_group;&lt;BR /&gt;end;&lt;BR /&gt;do _n_=1 to _n_;&lt;BR /&gt;set SPIES.SPIES_ANALYSIS_DEMOS;&lt;BR /&gt;by study_id;&lt;BR /&gt;if _n_=1 then Rand_group=_temp;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;drop _:;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am setting it to the same data set that is showing only treatment a and b&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2019 13:17:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585200#M166841</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2019-08-30T13:17:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to set first observation to equal last observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585204#M166842</link>
      <description>&lt;P&gt;And is it still show YES, NO?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it does, can you check upstream thoroughly. And if it is not confidential that would violate security/compliance, can you attach your sas dataset here? So I can work on it&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2019 13:25:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-first-observation-to-equal-last-observation/m-p/585204#M166842</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-08-30T13:25:50Z</dc:date>
    </item>
  </channel>
</rss>

