<?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: ASSIGNING VISITNUM in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/ASSIGNING-VISITNUM/m-p/600211#M76326</link>
    <description>&lt;P&gt;The computer is only a tool to carry out your wishes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you had the data sitting in front of you, and a pencil, what values would you assign?&amp;nbsp; Give an example.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Oct 2019 23:29:02 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2019-10-29T23:29:02Z</dc:date>
    <item>
      <title>ASSIGNING VISITNUM</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/ASSIGNING-VISITNUM/m-p/600139#M76323</link>
      <description>How to assign visitnum when all the Tests are done on same date?</description>
      <pubDate>Tue, 29 Oct 2019 18:42:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ASSIGNING-VISITNUM/m-p/600139#M76323</guid>
      <dc:creator>Rakesh93</dc:creator>
      <dc:date>2019-10-29T18:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: ASSIGNING VISITNUM</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/ASSIGNING-VISITNUM/m-p/600140#M76324</link>
      <description>&lt;P&gt;Show us a portion of your data.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2019 18:43:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ASSIGNING-VISITNUM/m-p/600140#M76324</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-10-29T18:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: ASSIGNING VISITNUM</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/ASSIGNING-VISITNUM/m-p/600211#M76326</link>
      <description>&lt;P&gt;The computer is only a tool to carry out your wishes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you had the data sitting in front of you, and a pencil, what values would you assign?&amp;nbsp; Give an example.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2019 23:29:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ASSIGNING-VISITNUM/m-p/600211#M76326</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-10-29T23:29:02Z</dc:date>
    </item>
    <item>
      <title>Re: ASSIGNING VISITNUM</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/ASSIGNING-VISITNUM/m-p/600412#M76327</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/294186"&gt;@Rakesh93&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;How to assign visitnum when all the Tests are done on same date?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You really should show a brief example of your input data and what you would expect the output to look like.&lt;/P&gt;
&lt;P&gt;And if your dates are not SAS Date values then creating such will be the first step.&lt;/P&gt;
&lt;P&gt;I am guessing that you want the same visit number for each test on the same day and that the count should start over based on some sort of ID variable(s).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here may be one way:&lt;/P&gt;
&lt;PRE&gt;data have;
   input id date :date9. test $;
   format date date9.;
datalines;
1  01Jan2019 A
1  01Jan2019 B
1  01Jan2019 Q
1  01Jan2019 T
1  04Jan2019 Q
1  04Jan2019 T
1  08Jan2019 Z
1  08Jan2019 R
;

/* Next step Assumes the data is actually 
sorted by Id and date
*/

data want;
   set have;
   by id date;
   retain visitnum;
   if first.id then visitnum=1;
   else if first.date then visitnum+1;
run;
&lt;/PRE&gt;
&lt;P&gt;If it takes more than a single variable to identify an individual then you may need to provide a more detailed example.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2019 15:21:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ASSIGNING-VISITNUM/m-p/600412#M76327</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-11-01T15:21:32Z</dc:date>
    </item>
  </channel>
</rss>

