<?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: unsecheduled visit number same day have two dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/unsecheduled-visit-number-same-day-have-two-dates/m-p/463256#M118005</link>
    <description>&lt;P&gt;As I said, fiddle with the if's to get what you want, as you haven't posted example output.&amp;nbsp; I would guess:&lt;/P&gt;
&lt;PRE&gt;data want;
  set exp (rename=(visitno=v));
  retain visitno tmp;
  by id uv notsorted;
  if first.id then tmp=0;
  if first.uv and uv="" then do;
    tmp=tmp+0.1;
    visitno=v+tmp;
  end;
  if first.uv and un ne "" then do;
    tmp=tmp+0.1;
    visitno=v+tmp;
  end;
run;&lt;/PRE&gt;</description>
    <pubDate>Fri, 18 May 2018 09:22:37 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-05-18T09:22:37Z</dc:date>
    <item>
      <title>unsecheduled visit number same day have two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/unsecheduled-visit-number-same-day-have-two-dates/m-p/463234#M117985</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;visitno 1.1&amp;nbsp; 101,unsecheduled-20/mar/2018 in this&amp;nbsp; first five observations&amp;nbsp; and next five observation's is&amp;nbsp; visitno 1.2 how to do&lt;/SPAN&gt;&lt;BR /&gt;data exp;&lt;BR /&gt;length uv $200;&lt;BR /&gt;infile datalines dsd truncover;&lt;BR /&gt;input id uv $ visitno;&lt;BR /&gt;datalines;&lt;BR /&gt;101,,1&lt;BR /&gt;101,unsecheduled-20/mar/2018&lt;BR /&gt;101,unsecheduled-20/mar/2018&lt;BR /&gt;101,unsecheduled-20/mar/2018&lt;BR /&gt;101,unsecheduled-20/mar/2018&lt;BR /&gt;101,unsecheduled-20/mar/2018&lt;BR /&gt;101,unsecheduled-21/mar/2018&lt;BR /&gt;101,unsecheduled-21/mar/2018&lt;BR /&gt;101,unsecheduled-21/mar/2018&lt;BR /&gt;101,unsecheduled-21/mar/2018&lt;BR /&gt;101,unsecheduled-21/mar/2018&lt;BR /&gt;101,,2&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 May 2018 07:39:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/unsecheduled-visit-number-same-day-have-two-dates/m-p/463234#M117985</guid>
      <dc:creator>teja5959</dc:creator>
      <dc:date>2018-05-18T07:39:47Z</dc:date>
    </item>
    <item>
      <title>Re: unsecheduled visit number same day have two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/unsecheduled-visit-number-same-day-have-two-dates/m-p/463244#M117994</link>
      <description>&lt;P&gt;Good idea to show what the output should look like.&amp;nbsp; This is first draft to show groupings, you would need to fiddle with the if's to get exactly what you want;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set exp (rename=(visitno=v));
  retain visitno tmp;
  by id uv notsorted;
  if first.id then tmp=0;
  if first.uv and uv="" then do;
    tmp=tmp+0.1;
    visitno=v+tmp;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 May 2018 08:17:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/unsecheduled-visit-number-same-day-have-two-dates/m-p/463244#M117994</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-05-18T08:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: unsecheduled visit number same day have two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/unsecheduled-visit-number-same-day-have-two-dates/m-p/463252#M118002</link>
      <description>&lt;P&gt;your placed all&amp;nbsp;&lt;SPAN&gt;visitno 1.1 but i want this way here&amp;nbsp;unsecheduled different date's .so i want this structure&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;uv&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;visitno&amp;nbsp;&lt;/P&gt;&lt;P&gt;unsecheduled-20/mar/2018&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1.1&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;unsecheduled-20/mar/2018&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1.1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;unsecheduled-20/mar/2018&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1.1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;unsecheduled-20/mar/2018&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1.1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;unsecheduled-20/mar/2018&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1.1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;unsecheduled-21/mar/2018&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1.2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;unsecheduled-21/mar/2018&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1.2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;unsecheduled-21/mar/2018&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1.2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;unsecheduled-21/mar/2018&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1.2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;unsecheduled-21/mar/2018&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1.2&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 May 2018 08:47:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/unsecheduled-visit-number-same-day-have-two-dates/m-p/463252#M118002</guid>
      <dc:creator>teja5959</dc:creator>
      <dc:date>2018-05-18T08:47:20Z</dc:date>
    </item>
    <item>
      <title>Re: unsecheduled visit number same day have two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/unsecheduled-visit-number-same-day-have-two-dates/m-p/463255#M118004</link>
      <description>i dont want all visit no 1.1 first 5 placed 1.1 next 5 placed 1.2 because uu first 5 subjects different date next 5 different .</description>
      <pubDate>Fri, 18 May 2018 09:15:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/unsecheduled-visit-number-same-day-have-two-dates/m-p/463255#M118004</guid>
      <dc:creator>teja5959</dc:creator>
      <dc:date>2018-05-18T09:15:57Z</dc:date>
    </item>
    <item>
      <title>Re: unsecheduled visit number same day have two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/unsecheduled-visit-number-same-day-have-two-dates/m-p/463256#M118005</link>
      <description>&lt;P&gt;As I said, fiddle with the if's to get what you want, as you haven't posted example output.&amp;nbsp; I would guess:&lt;/P&gt;
&lt;PRE&gt;data want;
  set exp (rename=(visitno=v));
  retain visitno tmp;
  by id uv notsorted;
  if first.id then tmp=0;
  if first.uv and uv="" then do;
    tmp=tmp+0.1;
    visitno=v+tmp;
  end;
  if first.uv and un ne "" then do;
    tmp=tmp+0.1;
    visitno=v+tmp;
  end;
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 May 2018 09:22:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/unsecheduled-visit-number-same-day-have-two-dates/m-p/463256#M118005</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-05-18T09:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: unsecheduled visit number same day have two dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/unsecheduled-visit-number-same-day-have-two-dates/m-p/463359#M118047</link>
      <description>&lt;P&gt;Assuming i understand what you want:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data exp;
length uv $200;
infile datalines dsd truncover;
input id uv $ visitno;
datalines;
101,,1
101,unsecheduled-20/mar/2018
101,unsecheduled-20/mar/2018
101,unsecheduled-20/mar/2018
101,unsecheduled-20/mar/2018
101,unsecheduled-20/mar/2018
101,unsecheduled-21/mar/2018
101,unsecheduled-21/mar/2018
101,unsecheduled-21/mar/2018
101,unsecheduled-21/mar/2018
101,unsecheduled-21/mar/2018
101,,2
;
run;

data want;
set exp;
by id;
retain _v;
_k=lag(uv);
if first.id then call missing(_v);
if visitno then _v=visitno;
else if missing(lag(uv)) then _v+.1;
else if _k ne uv then  _v+.1;
if missing(visitno) then visitno=_v;
drop _:;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 May 2018 14:51:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/unsecheduled-visit-number-same-day-have-two-dates/m-p/463359#M118047</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-05-18T14:51:04Z</dc:date>
    </item>
  </channel>
</rss>

