<?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: Convert list in 2 columns to a continuous list in a single column in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710538#M218745</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/349550"&gt;@Ja5ya&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;... the character values have around 20 digits and I need to use it in a hash later on using the 20 digit value. My data is a concatenation of an id and sas date.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/349550"&gt;@Ja5ya&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would avoid that concatenation as long as possible. As has been shown, incrementing a numeric variable containing integer values such as SAS dates&amp;nbsp;is very easy. Then the ID would not be affected by the incrementation, which is good, and it could be used as a BY variable, which is even better, not to mention the formatting options for the separate date variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you're talking about a &lt;EM&gt;SAS&lt;/EM&gt; hash object -- they can use &lt;EM&gt;composite&lt;/EM&gt; keys consisting of two or more separate variables (also of mixed types). Otherwise, a concatenation could be done temporarily, just for the hashing operations.&lt;/P&gt;</description>
    <pubDate>Mon, 11 Jan 2021 13:21:27 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2021-01-11T13:21:27Z</dc:date>
    <item>
      <title>Convert list in 2 columns to a continuous list in a single column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710497#M218722</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I have a dataset in which 2 fields('first' and 'last') contains the value of a particular field('amount'). I would like to use this dataset to create a new one containing the continuous list of the 2 fields in SAS.&lt;/P&gt;&lt;P&gt;Note: All fields are character types in the dataset.&lt;BR /&gt;Example below:&lt;/P&gt;&lt;P&gt;Input:&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;first&lt;/TD&gt;&lt;TD&gt;last&lt;/TD&gt;&lt;TD&gt;amount&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;0%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;3%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;6%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;8%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11&lt;/TD&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;TD&gt;10%&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;SPAN class="token datalines string"&gt;&lt;SPAN class="token punctuation"&gt;Output:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;field1&lt;/TD&gt;&lt;TD&gt;amount&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;0%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;0%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;3%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;3%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;3%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;6%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;6%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;TD&gt;8%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;8%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11&lt;/TD&gt;&lt;TD&gt;10%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;TD&gt;10%&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;SPAN class="token datalines string"&gt;&lt;SPAN class="token punctuation"&gt;Please help. Thanks!&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2021 06:02:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710497#M218722</guid>
      <dc:creator>Ja5ya</dc:creator>
      <dc:date>2021-01-11T06:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: Convert list in 2 columns to a continuous list in a single column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710502#M218723</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile cards;
  input first last amount;
cardfs;
0 3 0
4 6 3
7 8 6
9 10 8
11 12 10
; run;

data want;
 set have;
      do field1=first to last; output; end;
      keep field1 amount;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Jan 2021 06:43:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710502#M218723</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-01-11T06:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: Convert list in 2 columns to a continuous list in a single column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710504#M218724</link>
      <description>&lt;P&gt;Or you may prefer:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile cards truncover;
  input first last amount $4.;
cardfs;
0 3 0%
4 6 3%
7 8 6%
9 10 8%
11 12 10%
; run;

data want;
 set have;
      do field1=first to last; output; end;
      keep field1 amount;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Jan 2021 06:47:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710504#M218724</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-01-11T06:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: Convert list in 2 columns to a continuous list in a single column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710507#M218725</link>
      <description>&lt;P&gt;As the earlier suggestions from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;&amp;nbsp;imply, making FIRST and LAST character fields is a mistake.&amp;nbsp; They represent numbers, not character strings.&amp;nbsp; However, if that is a requirement, programming statements can convert back and forth between character and numeric.&amp;nbsp; For example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set have;
   do _n_=input(first, 8.) to input(last, 8.);
      field1 = left(put(_n_, 8.));
      output;
   end;
   keep field1 amount;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Again, it would be simpler to keep FIELD1 as numeric.&amp;nbsp; (The program above makes it character.)&amp;nbsp; Then you could assign it a value with a simpler expression:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   field1 = _n_;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But to keep it as character, you need more complex programming as in the top example.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2021 08:15:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710507#M218725</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-01-11T08:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: Convert list in 2 columns to a continuous list in a single column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710514#M218727</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this case, if first and last are kept character, SAS will do an implicit conversion and issue a note,&lt;/P&gt;
&lt;P&gt;so &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;'s code will also give the wanted result, though in a less "clean" manner.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;85   data have;
86       first="0";
87       last="10";
88       do _n_=first to last;
89           put _n_=;
90       end;
91   run;

NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
      88:12   88:21
_N_=0
_N_=1
_N_=2
_N_=3
_N_=4
_N_=5
_N_=6
_N_=7
_N_=8
_N_=9
_N_=10
NOTE: The data set WORK.HAVE has 1 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Jan 2021 10:24:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710514#M218727</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2021-01-11T10:24:40Z</dc:date>
    </item>
    <item>
      <title>Re: Convert list in 2 columns to a continuous list in a single column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710515#M218728</link>
      <description>&lt;P&gt;All your values are numeric (sequences or amounts), so they should be stored as such. See Maxim 33.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2021 10:27:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710515#M218728</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-01-11T10:27:58Z</dc:date>
    </item>
    <item>
      <title>Re: Convert list in 2 columns to a continuous list in a single column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710522#M218731</link>
      <description>You do make sense but the character values have around 20 digits and I need to use it in a hash later on using the 20 digit value. My data is a concatenation of an id and sas date. For instance:&lt;BR /&gt;start end amount&lt;BR /&gt;0000333330200007322 0000333330200007326 0%&lt;BR /&gt;1000333330200007327 1000333330200007330 1%&lt;BR /&gt;0000333330200007327 0000333330200007330 10%&lt;BR /&gt;So what could be the best way to list all the variables in between the start and end values?&lt;BR /&gt;</description>
      <pubDate>Mon, 11 Jan 2021 11:17:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710522#M218731</guid>
      <dc:creator>Ja5ya</dc:creator>
      <dc:date>2021-01-11T11:17:04Z</dc:date>
    </item>
    <item>
      <title>Re: Convert list in 2 columns to a continuous list in a single column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710529#M218737</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/349550"&gt;@Ja5ya&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;You do make sense but the character values have around 20 digits and I need to use it in a hash later on using the 20 digit value. My data is a concatenation of an id and sas date. For instance:&lt;BR /&gt;start end amount&lt;BR /&gt;0000333330200007322 0000333330200007326 0%&lt;BR /&gt;1000333330200007327 1000333330200007330 1%&lt;BR /&gt;0000333330200007327 0000333330200007330 10%&lt;BR /&gt;So what could be the best way to list all the variables in between the start and end values?&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Could be numbers with z-Format attached.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2021 11:41:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710529#M218737</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-01-11T11:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: Convert list in 2 columns to a continuous list in a single column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710531#M218739</link>
      <description>&lt;P&gt;Since you can't work reliably with 19-digit numbers in SAS (precision runs out at around 16 digits), I would split the strings into two numbers and run several (partially nested) DO loops:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input start :$19. end :$19. amount :percent6.;
format amount percent6.;
datalines;
0000333330200007322 0000333330200007326 0%
1000333330200007327 1000333330200007330 1%
0000000000999999999 0000000001000000001 5%
0000333330200007327 0000333330200007330 10%
;

data want;
length field1 $19;
set have;
if substr(start,1,10) = substr(end,1,10)
then do;
  do inner = input(substr(start,11,9),9.) to input(substr(end,11,9),9.);
    field1 = substr(start,1,10) !! put(inner,z9.);
    output;
  end;
end;
else do;
  do inner = input(substr(start,11,9),9.) to 999999999;
    field1 = substr(start,1,10) !! put(inner,z9.);
    output;
  end;
  do outer = input(substr(start,11,9),10.) + 1 to input(substr(end,1,10),10.) - 1;
    do inner = 0 to 999999999;
      field1 = put(outer,z10.) !! put(inner,z9.);
      output;
    end;
  end;
  do inner = 0 to input(substr(end,11,9),9.);
    field1 = substr(end,1,10) !! put(inner,z9.);
    output;
  end;
end;
keep field1 amount;
run;

proc print data=want noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I added an observation to illustrate the "outer" switch.&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;field1	amount
0000333330200007322	0%
0000333330200007323	0%
0000333330200007324	0%
0000333330200007325	0%
0000333330200007326	0%
1000333330200007327	1%
1000333330200007328	1%
1000333330200007329	1%
1000333330200007330	1%
0000000000999999999	5%
0000000001000000000	5%
0000000001000000001	5%
0000333330200007327	10%
0000333330200007328	10%
0000333330200007329	10%
0000333330200007330	10%
&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Jan 2021 12:10:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710531#M218739</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-01-11T12:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: Convert list in 2 columns to a continuous list in a single column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710532#M218740</link>
      <description>&lt;P&gt;The two FIRST variables where first digit is 0 works fine but the one with first digit=1 does not.&lt;/P&gt;
&lt;P&gt;May be someone else will give it solve it:&lt;/P&gt;
&lt;P&gt;The code is:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
length first last $19 amount $4;
  infile cards truncover;
  input first last amount $;
cards;
0000333330200007322 0000333330200007326 0%
1000333330200007327 1000333330200007330 1%
0000333330200007327 0000333330200007330 10%
run;

proc sort data=have; by first; run;

data want;
   retain field1 amount;
   set have;
   f = input(first,19.);
   l = input(last,19.);
   times = int(l - f +1 );
   put _N_= times=;
   do i=1 to times;
      field1 = put(int(f +i -1),z19.);
      output;
   end;
   keep field1 amount;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;my issue is getting fault computation of TIMES as shown in the log for _N_=3 (after sort):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;_N_=1 times=5
_N_=2 times=4
_N_=3 times=1  &amp;lt;&amp;lt;&amp;lt;&amp;lt; should be 4 !!!&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Jan 2021 12:12:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710532#M218740</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-01-11T12:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: Convert list in 2 columns to a continuous list in a single column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710538#M218745</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/349550"&gt;@Ja5ya&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;... the character values have around 20 digits and I need to use it in a hash later on using the 20 digit value. My data is a concatenation of an id and sas date.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/349550"&gt;@Ja5ya&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would avoid that concatenation as long as possible. As has been shown, incrementing a numeric variable containing integer values such as SAS dates&amp;nbsp;is very easy. Then the ID would not be affected by the incrementation, which is good, and it could be used as a BY variable, which is even better, not to mention the formatting options for the separate date variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you're talking about a &lt;EM&gt;SAS&lt;/EM&gt; hash object -- they can use &lt;EM&gt;composite&lt;/EM&gt; keys consisting of two or more separate variables (also of mixed types). Otherwise, a concatenation could be done temporarily, just for the hashing operations.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2021 13:21:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710538#M218745</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-01-11T13:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: Convert list in 2 columns to a continuous list in a single column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710557#M218752</link>
      <description>&lt;P&gt;The key to the problem is that you intend to create a hash table later.&amp;nbsp; Don't do it.&amp;nbsp; Use a format for look-up purposes instead of a hash table.&amp;nbsp; Formats easily handle ranges.&amp;nbsp; Your intention to use a hash table is what forces you to jump through all these hoops.&amp;nbsp; Here's how easy(?) a format would be.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data fmt_in;
   set have end=done;
   length label $ 9;
   label=amount;
   rename first=start  last=end;
   retain fmtname '$amt';
   output;
   if done;
   hlo='O';
   label='Not found';
   output;
run;

proc format cntlin=fmt_in;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To use the format, you have to be able to create the key that you would have needed for a hash table:&amp;nbsp; ID + date.&amp;nbsp; You can then use either of these as appropriate:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;format key $amt.;

retrieved_amt = put(key, $amt.);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Jan 2021 14:46:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710557#M218752</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-01-11T14:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: Convert list in 2 columns to a continuous list in a single column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710773#M218856</link>
      <description>Yeah, I do understand format works way better. But actually, I am converting the format code into hash code as it is causing an exception error in SAS. This error occurs quite frequently(not everytime) so needed an alternative to proc format code.</description>
      <pubDate>Tue, 12 Jan 2021 10:49:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710773#M218856</guid>
      <dc:creator>Ja5ya</dc:creator>
      <dc:date>2021-01-12T10:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: Convert list in 2 columns to a continuous list in a single column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710774#M218857</link>
      <description>&lt;P&gt;Concur with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;.&lt;/P&gt;
&lt;P&gt;Keep the variables separate, especially when you use a hash object, which allows multiple keys.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 10:59:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710774#M218857</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-01-12T10:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: Convert list in 2 columns to a continuous list in a single column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710783#M218863</link>
      <description>&lt;P&gt;Though you signed my previous post as a result, due to important remarks of other contributors and assuming that last 4 digits of FIRST and LAST variables are the sas date while the 1st part is common then next code will correct where&lt;/P&gt;
&lt;P&gt;the 1st digit is 1:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
length first last $19 amount $4;
  infile cards truncover;
  input first last amount $;
cards;
0000333330200007322 0000333330200007326 0%
1000333330200007327 1000333330200007330 1%
0000333330200007327 0000333330200007330 10%
run;

proc sort data=have; by first; run;

data want;
   retain field1 amount;
   set have;
   f = input(substr(first,16,4),4.);
   l = input(substr(last,16,4),4.);
   times = int(l - f +1 );
   put _N_= f= l= times=;
   do i=1 to times;
      field1 = cats(substr(first,1,15),put((f+i-1),z4.));
      output;
   end;
   keep field1 amount;
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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 11:47:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-list-in-2-columns-to-a-continuous-list-in-a-single/m-p/710783#M218863</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-01-12T11:47:10Z</dc:date>
    </item>
  </channel>
</rss>

