<?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: Help in my pgm in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Help-in-my-pgm/m-p/676465#M203979</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one;
input id flag $ lday;
datalines;
1 N 1
1 N 3
1 Y 4
1 Y 6
1 Y 10
1 N 12
1 Y 15
1 N 20
2 Y 10
2 Y 15
3 Y 20
;;;
run;

data want;
 set one;
 by id flag notsorted;
 retain impday;
 if first.flag then call missing(impday);
 if first.flag and flag='Y' then impday=lday;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 13 Aug 2020 12:44:38 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2020-08-13T12:44:38Z</dc:date>
    <item>
      <title>Help in my pgm</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-in-my-pgm/m-p/676205#M203858</link>
      <description>&lt;P&gt;Dear,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I need to populate&lt;FONT color="#FF6600"&gt; IMPDAY&lt;/FONT&gt; variable value for records having flag='Y'. The first record with flag='Y' after last record where flag='N' then set impday=lday. for all records until another record with flag='N'&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one;
input id flag $ lday;
datalines;
1 N 1
1 N 3
1 Y 4
1 Y 6
1 Y 10
1 N 12
1 Y 15
1 N 20&lt;BR /&gt;2 Y 10&lt;BR /&gt;2 Y 15&lt;BR /&gt;3 Y 20
;

OUTPUT NEEDED
ID FLAG LDAY  IMPDAY
1    N   1 
1    N   3
1    Y   4       4       
1    Y   6      4
1    Y  10      4
1    N  12
1    Y   15      15
1    N   20&lt;BR /&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Y&amp;nbsp;&amp;nbsp;10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;10&lt;BR /&gt;2    Y   15     10&lt;BR /&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Y&amp;nbsp;&amp;nbsp;&amp;nbsp;20&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;20&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;For OBS 3,4,5, the impday=4 because obs=3 is first lday after&amp;nbsp; flag=N.&amp;nbsp; &amp;nbsp;For obs=7, the impday=15, because it s first day after flag='N'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For id in 2 and 3, if there are no obs with flag='N' then i need to populate first record value as IMPDAY. Please suggest. Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 15:34:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-in-my-pgm/m-p/676205#M203858</guid>
      <dc:creator>knveraraju91</dc:creator>
      <dc:date>2020-08-12T15:34:49Z</dc:date>
    </item>
    <item>
      <title>Re: Help in my pgm</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-in-my-pgm/m-p/676206#M203859</link>
      <description>&lt;P&gt;Please edit your &lt;EM&gt;original&lt;/EM&gt; message in this thread to provide a meaningful subject line for your question, one that describes the question itself.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 15:45:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-in-my-pgm/m-p/676206#M203859</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-08-12T15:45:06Z</dc:date>
    </item>
    <item>
      <title>Re: Help in my pgm</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-in-my-pgm/m-p/676209#M203861</link>
      <description>Thank you very much your time. I think input records id=2 and id=3   were mixed with id=1 on last obs. Please check below and suggest me. Thank you&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;data one;&lt;BR /&gt;input id flag $ lday;&lt;BR /&gt;datalines;&lt;BR /&gt;1 N 1&lt;BR /&gt;1 N 3&lt;BR /&gt;1 Y 4&lt;BR /&gt;1 Y 6&lt;BR /&gt;1 Y 10&lt;BR /&gt;1 N 12&lt;BR /&gt;1 Y 15&lt;BR /&gt;1 N 20&lt;BR /&gt;2 Y 10&lt;BR /&gt;2 Y 15&lt;BR /&gt;3 Y 20&lt;BR /&gt;;&lt;BR /&gt;OUTPUT NEEDED&lt;BR /&gt;ID FLAG LDAY  IMPDAY&lt;BR /&gt;1    N   1 &lt;BR /&gt;1    N   3&lt;BR /&gt;1    Y   4      4       &lt;BR /&gt;1    Y   6      4&lt;BR /&gt;1    Y  10      4&lt;BR /&gt;1    N  12&lt;BR /&gt;1    Y   15     15&lt;BR /&gt;1    N   20&lt;BR /&gt;2    Y  10      10&lt;BR /&gt;2    Y   15     10&lt;BR /&gt;3    Y   20     20</description>
      <pubDate>Wed, 12 Aug 2020 15:47:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-in-my-pgm/m-p/676209#M203861</guid>
      <dc:creator>knveraraju91</dc:creator>
      <dc:date>2020-08-12T15:47:42Z</dc:date>
    </item>
    <item>
      <title>Re: Help in my pgm</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-in-my-pgm/m-p/676213#M203865</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one;
input id flag $ lday;
datalines;
1 N 1
1 N 3
1 Y 4
1 Y 6
1 Y 10
1 N 12
1 Y 15
1 N 20
2 Y 10
2 Y 15
3 Y 20
;;;
run;
proc sort; by id lday;
run;
data want;
set one;
by id;
retain impday .;
if first.id then impday=.;
if flag='Y' and missing(impday) then impday=lday;
if flag='N' then impday=.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Aug 2020 15:57:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-in-my-pgm/m-p/676213#M203865</guid>
      <dc:creator>smantha</dc:creator>
      <dc:date>2020-08-12T15:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: Help in my pgm</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-in-my-pgm/m-p/676224#M203873</link>
      <description>&lt;P&gt;If I understand correctly then try next code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one;
input id flag $ lday;
datalines;
1 N 1
1 N 3
1 Y 4
1 Y 6
1 Y 10
1 N 12
1 Y 15
1 N 202 Y 102 Y 153 Y 20
;
run;

data want;
 set one;
       retain impday;
      if flag= 'N' then impday = .; else
      if impday = . then impday = lday;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Aug 2020 16:27:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-in-my-pgm/m-p/676224#M203873</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-08-12T16:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: Help in my pgm</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-in-my-pgm/m-p/676465#M203979</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one;
input id flag $ lday;
datalines;
1 N 1
1 N 3
1 Y 4
1 Y 6
1 Y 10
1 N 12
1 Y 15
1 N 20
2 Y 10
2 Y 15
3 Y 20
;;;
run;

data want;
 set one;
 by id flag notsorted;
 retain impday;
 if first.flag then call missing(impday);
 if first.flag and flag='Y' then impday=lday;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Aug 2020 12:44:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-in-my-pgm/m-p/676465#M203979</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-08-13T12:44:38Z</dc:date>
    </item>
  </channel>
</rss>

