<?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: Creating a character string from different records within a BY group in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-character-string-from-different-records-within-a-BY/m-p/69642#M15096</link>
    <description>Create a second file with the BY var list, using a DATA step, and define a RETAIN statement for the "concatenated string" variable.  You will want to explore using the FIRST.&lt;BREAK_VARIABLE&gt; and LAST.&lt;BREAK_VARIABLE&gt; technique to assign or concatenate (either using || or !! for your concatenation operator), creating your new variable.  Then use a DATA step MERGE process to combine your original file with the second file, placing your new variable back on the original file, as needed.&lt;BR /&gt;
&lt;BR /&gt;
You can search the SAS support  &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website using the Google advanced argument below to find related SAS-hosted documentation and other technical reference papers on the subject:&lt;BR /&gt;
&lt;BR /&gt;
data step by processing first last site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;/BREAK_VARIABLE&gt;&lt;/BREAK_VARIABLE&gt;</description>
    <pubDate>Sun, 06 Sep 2009 03:41:29 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2009-09-06T03:41:29Z</dc:date>
    <item>
      <title>Creating a character string from different records within a BY group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-character-string-from-different-records-within-a-BY/m-p/69641#M15095</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I'm trying to string together all values for a particular character variable that are observed within a BY group.  For example, if i have the following data for the three observations within a BY group:&lt;BR /&gt;
&lt;BR /&gt;
id1   aa&lt;BR /&gt;
id2   bb&lt;BR /&gt;
id3   cc&lt;BR /&gt;
&lt;BR /&gt;
How would I create a character string variable with the value "aa-bb-cc" that would be reported as such for all three observations within the BY group?&lt;BR /&gt;
Thanks so much,&lt;BR /&gt;
NG</description>
      <pubDate>Sun, 06 Sep 2009 02:02:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-character-string-from-different-records-within-a-BY/m-p/69641#M15095</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-09-06T02:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a character string from different records within a BY group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-character-string-from-different-records-within-a-BY/m-p/69642#M15096</link>
      <description>Create a second file with the BY var list, using a DATA step, and define a RETAIN statement for the "concatenated string" variable.  You will want to explore using the FIRST.&lt;BREAK_VARIABLE&gt; and LAST.&lt;BREAK_VARIABLE&gt; technique to assign or concatenate (either using || or !! for your concatenation operator), creating your new variable.  Then use a DATA step MERGE process to combine your original file with the second file, placing your new variable back on the original file, as needed.&lt;BR /&gt;
&lt;BR /&gt;
You can search the SAS support  &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website using the Google advanced argument below to find related SAS-hosted documentation and other technical reference papers on the subject:&lt;BR /&gt;
&lt;BR /&gt;
data step by processing first last site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;/BREAK_VARIABLE&gt;&lt;/BREAK_VARIABLE&gt;</description>
      <pubDate>Sun, 06 Sep 2009 03:41:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-character-string-from-different-records-within-a-BY/m-p/69642#M15096</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-09-06T03:41:29Z</dc:date>
    </item>
  </channel>
</rss>

