<?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: Question regarding &amp;quot;By&amp;quot; processing in data step in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Question-regarding-quot-By-quot-processing-in-data-step/m-p/240074#M44262</link>
    <description>&lt;P&gt;Yes, thank you very much. &amp;nbsp;I was doing something similar except without PROC SQL but I see how this is much more efficient.&lt;/P&gt;</description>
    <pubDate>Fri, 18 Dec 2015 19:20:52 GMT</pubDate>
    <dc:creator>chuakp</dc:creator>
    <dc:date>2015-12-18T19:20:52Z</dc:date>
    <item>
      <title>Question regarding "By" processing in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-regarding-quot-By-quot-processing-in-data-step/m-p/240024#M44241</link>
      <description>&lt;P&gt;I have a claims database with enrolle ID, unique claim ID, date, and a field called "Dx_string", which I created by concatatening all of the five-digit ICD-9 diagnosis codes on the claim. &amp;nbsp;It looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ID &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CLAIM_ID &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DATE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DX_STRING&lt;/P&gt;
&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 100 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1/1/2015 &amp;nbsp; &amp;nbsp; &amp;nbsp; 7804 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 101 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1/1/2015 &amp;nbsp; &amp;nbsp; &amp;nbsp; 30921 39021&lt;/P&gt;
&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 102 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2/1/2015 &amp;nbsp; &amp;nbsp; &amp;nbsp; 30943 902 01920&lt;/P&gt;
&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 103 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3/1/2015 &amp;nbsp; &amp;nbsp; &amp;nbsp; 011&lt;/P&gt;
&lt;P&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 104 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4/1/2015 &amp;nbsp; &amp;nbsp; &amp;nbsp; 4530&lt;/P&gt;
&lt;P&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 105 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 5/1/2015 &amp;nbsp; &amp;nbsp; &amp;nbsp; V9090&lt;/P&gt;
&lt;P&gt;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 106 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6/1/2015 &amp;nbsp; &amp;nbsp; &amp;nbsp; E884 3092&lt;/P&gt;
&lt;P&gt;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 107 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6/1/2015 &amp;nbsp; &amp;nbsp; &amp;nbsp; 7039&lt;/P&gt;
&lt;P&gt;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 108 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6/1/2015 &amp;nbsp; &amp;nbsp; &amp;nbsp; 800 0930 1092 &amp;nbsp;&lt;/P&gt;
&lt;P&gt;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 109 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 7/1/2015 &amp;nbsp; &amp;nbsp; &amp;nbsp; 3094&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;data have;&lt;BR /&gt;input ID CLAIM_ID DATE $ DX_STRING $30.;&lt;BR /&gt;datalines;&lt;BR /&gt;1 100 1/1/2015 7804&lt;BR /&gt;1 101 1/1/2015 30921 39021&lt;BR /&gt;1 102 2/1/2015 30943 902 01920&lt;BR /&gt;1 103 3/1/2015 011&lt;BR /&gt;2 104 4/1/2015 4530&lt;BR /&gt;2 105 5/1/2015 V9090&lt;BR /&gt;3 106 6/1/2015 E884 3092&lt;BR /&gt;3 107 6/1/2015 7039&lt;BR /&gt;3 108 6/1/2015 800 0930 1092&lt;BR /&gt;3 109 7/1/2015 3094&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My goal is to concatenate all DX_STRING values that occur on the same date into a larger string called DX_STRING_DAY:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;ID &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C&lt;/SPAN&gt;&lt;SPAN&gt;LAIM_&lt;/SPAN&gt;&lt;SPAN&gt;ID &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DATE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DX_STRING&lt;/SPAN&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DX_STRING_DAY&lt;/P&gt;
&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 100 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1/1/2015 &amp;nbsp; &amp;nbsp; &amp;nbsp; 7804 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;7804 30921 39021&lt;/P&gt;
&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 101 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1/1/2015 &amp;nbsp; &amp;nbsp; &amp;nbsp; 30921 39021 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 7&lt;SPAN&gt;804 30921 39021&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 102 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2/1/2015 &amp;nbsp; &amp;nbsp; &amp;nbsp; 30943 902 01920 &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;30943 902 01920&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 103 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3/1/2015 &amp;nbsp; &amp;nbsp; &amp;nbsp; 011 &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;011&lt;/P&gt;
&lt;P&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 104 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4/1/2015 &amp;nbsp; &amp;nbsp; &amp;nbsp; 4530 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4530&lt;/P&gt;
&lt;P&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 105 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 5/1/2015 &amp;nbsp; &amp;nbsp; &amp;nbsp; V9090 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;V9090&lt;/P&gt;
&lt;P&gt;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 106 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6/1/2015 &amp;nbsp; &amp;nbsp; &amp;nbsp; E884 3092 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; E844 3092 7039 800 0930 1092&lt;/P&gt;
&lt;P&gt;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 107 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6/1/2015 &amp;nbsp; &amp;nbsp; &amp;nbsp; 7039 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;E844 3092 7039 800 0930 1092&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 108 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6/1/2015 &amp;nbsp; &amp;nbsp; &amp;nbsp; 800 0930 1092 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;E844 3092 7039 800 0930 1092&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 109 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 7/1/2015 &amp;nbsp; &amp;nbsp; &amp;nbsp; 3094 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3094&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can make the variable called DX_STRING_DAY using this code, but then I can't figure out how to make all values of DX_STRING_DAY the same within an individual on a given day.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data want; set have;&lt;BR /&gt;by id date;&lt;BR /&gt;retain dx_string_day;&lt;BR /&gt;if first.date then dx_string_day = dx_string;&lt;BR /&gt;if not(first.date) then dx_string_day = catx(" ", dx_string_day, dx_string);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any suggestions? &amp;nbsp;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Dec 2015 15:52:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-regarding-quot-By-quot-processing-in-data-step/m-p/240024#M44241</guid>
      <dc:creator>chuakp</dc:creator>
      <dc:date>2015-12-18T15:52:11Z</dc:date>
    </item>
    <item>
      <title>Re: Question regarding "By" processing in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-regarding-quot-By-quot-processing-in-data-step/m-p/240029#M44243</link>
      <description>You need to add a length to the dx_string_day variable so it's big enough to hold all the values.&lt;BR /&gt;&lt;BR /&gt;length dx_string_day $100.;&lt;BR /&gt;&lt;BR /&gt;You could also use proc transpose, though it would put each diagnosis into a different variable.&lt;BR /&gt;&lt;BR /&gt;In general, when working with dx codes, I've found the long format more useful. &lt;BR /&gt;</description>
      <pubDate>Fri, 18 Dec 2015 15:58:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-regarding-quot-By-quot-processing-in-data-step/m-p/240029#M44243</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-12-18T15:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: Question regarding "By" processing in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-regarding-quot-By-quot-processing-in-data-step/m-p/240040#M44247</link>
      <description>&lt;P&gt;Totally agree with Reeza, long form is easier to program with. &amp;nbsp;Take a simple example, you want to get counts of code by subject, long form you could simply use a proc freq, by id. &amp;nbsp;With the concatenated verision you would have to do looping over to get counts and then sum those.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Dec 2015 16:16:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-regarding-quot-By-quot-processing-in-data-step/m-p/240040#M44247</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-12-18T16:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: Question regarding "By" processing in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-regarding-quot-By-quot-processing-in-data-step/m-p/240061#M44253</link>
      <description>&lt;P&gt;I completely agree that long form is easier for programming, but in this case I actually need to keep the claims in wide form to mesh with the rest of the program. &amp;nbsp;Do you have any suggestions?&lt;/P&gt;</description>
      <pubDate>Fri, 18 Dec 2015 17:40:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-regarding-quot-By-quot-processing-in-data-step/m-p/240061#M44253</guid>
      <dc:creator>chuakp</dc:creator>
      <dc:date>2015-12-18T17:40:36Z</dc:date>
    </item>
    <item>
      <title>Re: Question regarding "By" processing in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-regarding-quot-By-quot-processing-in-data-step/m-p/240069#M44258</link>
      <description>&lt;P&gt;Hi..not too sure if this is what you want:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; want; &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; have;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;by&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; id date;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;retain&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; dx_string_day;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; first.date &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;then&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; dx_string_day = dx_string;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;not&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;(first.date) &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;then&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; dx_string_day = catx(&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;" "&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;, dx_string_day, dx_string);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;SORT&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DATA&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;=WANT;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;BY&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; ID DATE;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; WANT1; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;SET&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; WANT;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;BY&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; id date;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;IF&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; LAST.DATE;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;SQL&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;CREATE&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;TABLE&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; WANT2 &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;AS&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;SELECT&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DISTINCT&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;WANT.ID,&lt;/P&gt;
&lt;P&gt;WANT.CLAIM_ID,&lt;/P&gt;
&lt;P&gt;WANT.DATE,&lt;/P&gt;
&lt;P&gt;WANT.DX_STRING,&lt;/P&gt;
&lt;P&gt;WANT1.dx_string_day&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;FROM&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; WORK.WANT &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;LEFT&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;JOIN&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; WORK.WANT1 ON (WANT.ID = WANT1.ID) AND (WANT.DATE = WANT1.DATE);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;QUIT&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Dec 2015 18:52:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-regarding-quot-By-quot-processing-in-data-step/m-p/240069#M44258</guid>
      <dc:creator>twildone</dc:creator>
      <dc:date>2015-12-18T18:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: Question regarding "By" processing in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-regarding-quot-By-quot-processing-in-data-step/m-p/240074#M44262</link>
      <description>&lt;P&gt;Yes, thank you very much. &amp;nbsp;I was doing something similar except without PROC SQL but I see how this is much more efficient.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Dec 2015 19:20:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-regarding-quot-By-quot-processing-in-data-step/m-p/240074#M44262</guid>
      <dc:creator>chuakp</dc:creator>
      <dc:date>2015-12-18T19:20:52Z</dc:date>
    </item>
    <item>
      <title>Re: Question regarding "By" processing in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-regarding-quot-By-quot-processing-in-data-step/m-p/240199#M44286</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID CLAIM_ID DATE $ DX_STRING $30.;
datalines;
1 100 1/1/2015 7804
1 101 1/1/2015 30921 39021
1 102 2/1/2015 30943 902 01920
1 103 3/1/2015 011
2 104 4/1/2015 4530
2 105 5/1/2015 V9090
3 106 6/1/2015 E884 3092
3 107 6/1/2015 7039
3 108 6/1/2015 800 0930 1092
3 109 7/1/2015 3094
;
run;
data want;
 length DX_STRING_DAY $ 200;
 do until(last.date);
  set have;
  by ID DATE ;
  DX_STRING_DAY=catx(' ',DX_STRING_DAY ,DX_STRING );
 end;
  do until(last.date);
  set have;
  by ID DATE ;
  output;
 end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Dec 2015 02:25:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-regarding-quot-By-quot-processing-in-data-step/m-p/240199#M44286</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-12-21T02:25:04Z</dc:date>
    </item>
    <item>
      <title>Re: Question regarding "By" processing in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-regarding-quot-By-quot-processing-in-data-step/m-p/240374#M44328</link>
      <description>&lt;P&gt;Thanks for the solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My claims dataset has over 100 million observations and it's not clear to me how to choose a length for the DX_STRING_DAY variable. It's quite possible that this string could get really long if someone had something like 40 claims in a day. &amp;nbsp;On the other hand, I don't want to waste valuable hard drive space. &amp;nbsp;Any strategies on how to manage this situation? &amp;nbsp;I guess you could use something like a length of $1000 to be overly generous, then trim it later.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2015 01:52:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-regarding-quot-By-quot-processing-in-data-step/m-p/240374#M44328</guid>
      <dc:creator>chuakp</dc:creator>
      <dc:date>2015-12-22T01:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: Question regarding "By" processing in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-regarding-quot-By-quot-processing-in-data-step/m-p/240378#M44330</link>
      <description>One reason why the data isn't stored in this format...Is there a reason you want it in one variable? A proc transpose would create a variable for each of the diagnosis automatically.</description>
      <pubDate>Tue, 22 Dec 2015 02:13:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-regarding-quot-By-quot-processing-in-data-step/m-p/240378#M44330</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-12-22T02:13:33Z</dc:date>
    </item>
    <item>
      <title>Re: Question regarding "By" processing in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-regarding-quot-By-quot-processing-in-data-step/m-p/240385#M44336</link>
      <description>&lt;P&gt;In SAS ,each variable has the same length unlike other Data Base like Oracle have VARCHAR() format.&lt;/P&gt;
&lt;P&gt;If you don't want this kind of code, you can create many variables like&amp;nbsp;&lt;SPAN&gt;DX_STRING1 ,DX_STRING2,DX_STRING3,&amp;nbsp;DX_STRING4 &amp;nbsp;....... to hold these values.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2015 03:19:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-regarding-quot-By-quot-processing-in-data-step/m-p/240385#M44336</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-12-22T03:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: Question regarding "By" processing in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-regarding-quot-By-quot-processing-in-data-step/m-p/240391#M44342</link>
      <description>&lt;P&gt;Thanks. &amp;nbsp;I do understand your point. &amp;nbsp;I had tried it your way with proc transpose but was running into prolems.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Going back to the original structure of the claims (which has four diagnosis codes per claim), I have data like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; have&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;ID&lt;/SPAN&gt; CLAIM_ID &lt;SPAN class="token function"&gt;DATE&lt;/SPAN&gt; $ &lt;SPAN class="token number"&gt;DX&lt;SPAN style="line-height: 20px;"&gt;1 $ DX2 $ DX3 $ DX4&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token datalines"&gt;&lt;SPAN class="token keyword"&gt;datalines&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;SPAN class="token data string"&gt;
1 100 1/1/2015 7804   
1 101 1/1/2015 30921 39021
1 102 2/1/2015 30943 902 01920
1 103 3/1/2015 011
2 104 4/1/2015 4530
2 105 5/1/2015 V9090
3 106 6/1/2015 7039
3 107 6/1/2015 7039
3 108 6/1/2015 E884 0930 1092 0930
3 109 7/1/2015 3094
&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I want&amp;nbsp;to create a dataset that has all of the *unique* diagnosis codes that occurred on claims during the same day for a given individual, as below (I don't care about whether it was DX1, DX2, DX3, or DX4). &amp;nbsp;This would involve using proc transpose somehow to create a series of variables that I might call "DXSAMEDAY1-DXSAMEDAY5" (in this fake example, five variables would be created but it would in reality be way more). &amp;nbsp;I've been playing with the syntax of proc transpose and can't get this work, though. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'd appreciate suggestions on how to proceed. &amp;nbsp;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2015 04:43:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-regarding-quot-By-quot-processing-in-data-step/m-p/240391#M44342</guid>
      <dc:creator>chuakp</dc:creator>
      <dc:date>2015-12-22T04:43:46Z</dc:date>
    </item>
    <item>
      <title>Re: Question regarding "By" processing in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-regarding-quot-By-quot-processing-in-data-step/m-p/240419#M44351</link>
      <description>&lt;P&gt;Your problms, and future ones, all lie in the method of storing your data. &amp;nbsp;If you normalise your data, and work with the normalised data, you will find your code is simpler to work with. &amp;nbsp;This doesn't prevent you, if you want a proc report with transposed data, transposing it at that point.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile datalines dlm="," missover;
  input id claim_id date $ dx1 $ dx2 $ dx3 $ dx4 $;
datalines;
1,100,1/1/2015,7804,,   
1,101,1/1/2015,30921,39021,,
1,102,2/1/2015,30943,902,01920,
1,103,3/1/2015,011,,,
2,104,4/1/2015,4530,,,
2,105,5/1/2015,V9090,,,
3,106,6/1/2015,7039,,,
3,107,6/1/2015,7039,,,
3,108,6/1/2015,E884,0930,1092,0930
3,109,7/1/2015,3094,,,
;
run;

/* Normalise the data to have one DX per row */
proc transpose data=have out=want;
  by id claim_id date;
  var dx:;         /* Note the use of dx: which means all with the prefix dx */
run;

/* Sort duplicates and missings out */
proc sort data=want (drop=_name_ rename=(col1=dx)) nodupkey;
  by id claim_id date dx;
  where dx ne "";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You see from the above that finding duplicates, sorting etc. becomes so much easier with the different strcuture.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2015 09:49:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-regarding-quot-By-quot-processing-in-data-step/m-p/240419#M44351</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-12-22T09:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: Question regarding "By" processing in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-regarding-quot-By-quot-processing-in-data-step/m-p/240457#M44360</link>
      <description>This is a different question than your original question, please ask new questions in a new thread.</description>
      <pubDate>Tue, 22 Dec 2015 15:18:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-regarding-quot-By-quot-processing-in-data-step/m-p/240457#M44360</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-12-22T15:18:47Z</dc:date>
    </item>
  </channel>
</rss>

