<?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: assign sequential order in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/assign-sequential-order/m-p/745276#M233583</link>
    <description>&lt;P&gt;I guess you are establishing intervals of 4 in AVISITN to allow for inserting new observations that will fall between your current set of observations.&amp;nbsp; (Also, why is the first interval only 3?).&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming your new observations will always get integer values for AVISITN, does this mean you can guarantee there will never be more than 3 new observations between any of the current visits?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why not make your order variable into a number with integers for the cycle, and two decimals for the day within cycle, such as:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Cycle 1 Day 1                1.01
Cycle 1 Day 15               1.15
Cycle 2 Day 1                2.01
Cycle 2 Day 15               2.15
Cycle 3 Day 1                ..
Cycle 3 Day 15               ..
Cycle 4 Day 1                ..
Cycle 4 Day 15               ..
Cycle 5 Day 1                ..
Cycle 5 Day 15               ..
Cycle 6 Day 1                ..
Cycle 6 Day 15               ..
Cycle 7 Day 1                ..
Cycle 7 Day 15               ..
Cycle 8 Day 1                8.01
Cycle 8 Day 15               8.15
End of Treatment            98.0
Safety &amp;amp; Efficacy Follow-up 99.0
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Assuming you never have more than one visit on any given day, you will never have duplication, and you will always have room for new visits.&lt;/P&gt;</description>
    <pubDate>Wed, 02 Jun 2021 18:45:29 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2021-06-02T18:45:29Z</dc:date>
    <item>
      <title>assign sequential order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/assign-sequential-order/m-p/745259#M233576</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have data like below, I am trying to assign sequential order programmatically so that it will automatically rerun when more visits are there in the data.&lt;/P&gt;&lt;P&gt;Can you help me with how can I give sequential order for this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	input VISIT $1-30 VISITNUM;
	datalines;
Screening 						1 
Cycle 1 Day 1 					8 
Cycle 1 Day 15 					11 
Cycle 2 Day 1 					15 
Cycle 2 Day 15 					16 
Cycle 3 Day 1 					19 
Cycle 3 Day 15 					20 
Cycle 4 Day 1 					22 
Cycle 4 Day 15 					23 
Cycle 5 Day 1 					25 
Cycle 5 Day 15 					28 
Cycle 6 Day 1 					30 
Cycle 6 Day 15 					31 
Cycle 7 Day 1 					33 
Cycle 7 Day 15 					34 
Cycle 8 Day 1 					36 
Cycle 8 Day 15 	 				37 
End of Treatment 				197 
Safety &amp;amp; Efficacy Follow-up 	198 
Unsched 						208 
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Adithya&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jun 2021 17:58:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/assign-sequential-order/m-p/745259#M233576</guid>
      <dc:creator>chinna0369</dc:creator>
      <dc:date>2021-06-02T17:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: assign sequential order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/assign-sequential-order/m-p/745263#M233580</link>
      <description>Please show your desired output. &lt;BR /&gt;I'm guessing you want something like this but it's unclear. &lt;BR /&gt;&lt;A href="https://stats.idre.ucla.edu/sas/faq/how-can-i-create-an-enumeration-variable-by-groups/" target="_blank"&gt;https://stats.idre.ucla.edu/sas/faq/how-can-i-create-an-enumeration-variable-by-groups/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 02 Jun 2021 18:06:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/assign-sequential-order/m-p/745263#M233580</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-06-02T18:06:48Z</dc:date>
    </item>
    <item>
      <title>Re: assign sequential order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/assign-sequential-order/m-p/745264#M233581</link>
      <description>&lt;P&gt;My desired output is to create AVISITN in sequential order like below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	input VISIT $1-30 VISITNUM AVISITN;
	datalines;
Screening 						1	1 
Cycle 1 Day 1 					8 	4
Cycle 1 Day 15 					11 	8
Cycle 2 Day 1 					15 	12
Cycle 2 Day 15 					16	16 
Cycle 3 Day 1 					19 	20
Cycle 3 Day 15 					20 	24
Cycle 4 Day 1 					22 	28
Cycle 4 Day 15 					23 	32
Cycle 5 Day 1 					25 	36
Cycle 5 Day 15 					28 	40
Cycle 6 Day 1 					30 	44
Cycle 6 Day 15 					31 	48
Cycle 7 Day 1 					33 	52
Cycle 7 Day 15 					34 	56
Cycle 8 Day 1 					36 	60
Cycle 8 Day 15 	 				37 	64
End of Treatment 				197 68
Safety &amp;amp; Efficacy Follow-up 	198 72
Unsched 						208 76
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ad&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jun 2021 18:13:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/assign-sequential-order/m-p/745264#M233581</guid>
      <dc:creator>chinna0369</dc:creator>
      <dc:date>2021-06-02T18:13:50Z</dc:date>
    </item>
    <item>
      <title>Re: assign sequential order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/assign-sequential-order/m-p/745276#M233583</link>
      <description>&lt;P&gt;I guess you are establishing intervals of 4 in AVISITN to allow for inserting new observations that will fall between your current set of observations.&amp;nbsp; (Also, why is the first interval only 3?).&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming your new observations will always get integer values for AVISITN, does this mean you can guarantee there will never be more than 3 new observations between any of the current visits?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why not make your order variable into a number with integers for the cycle, and two decimals for the day within cycle, such as:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Cycle 1 Day 1                1.01
Cycle 1 Day 15               1.15
Cycle 2 Day 1                2.01
Cycle 2 Day 15               2.15
Cycle 3 Day 1                ..
Cycle 3 Day 15               ..
Cycle 4 Day 1                ..
Cycle 4 Day 15               ..
Cycle 5 Day 1                ..
Cycle 5 Day 15               ..
Cycle 6 Day 1                ..
Cycle 6 Day 15               ..
Cycle 7 Day 1                ..
Cycle 7 Day 15               ..
Cycle 8 Day 1                8.01
Cycle 8 Day 15               8.15
End of Treatment            98.0
Safety &amp;amp; Efficacy Follow-up 99.0
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Assuming you never have more than one visit on any given day, you will never have duplication, and you will always have room for new visits.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jun 2021 18:45:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/assign-sequential-order/m-p/745276#M233583</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-06-02T18:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: assign sequential order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/assign-sequential-order/m-p/745280#M233585</link>
      <description>&lt;P&gt;This matches your desired output values for Avisitn for the given input data set:&lt;/P&gt;
&lt;PRE&gt;data want;
   set have;
   if _n_=1 then AVISITN=1;
   else AVISITN = (_n_-1)*4;
run;&lt;/PRE&gt;
&lt;P&gt;Please note that when I copy and paste your data step into an editor inconsistent use of TAB characters means that many of the VISITNUM values appear in column 28 leading to a number of incomplete records or invalid data.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jun 2021 18:52:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/assign-sequential-order/m-p/745280#M233585</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-06-02T18:52:59Z</dc:date>
    </item>
  </channel>
</rss>

