<?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: SAS matching two columns together in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/SAS-matching-two-columns-together/m-p/577069#M13142</link>
    <description>Yes it's possible. If you need help on how to do so please provide some more details on what your input data looks like and what you expect as output. Sample data helps a lot.</description>
    <pubDate>Fri, 26 Jul 2019 20:00:53 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-07-26T20:00:53Z</dc:date>
    <item>
      <title>SAS matching two columns together</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-matching-two-columns-together/m-p/577068#M13141</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was wondering if SAS had the capability of matching two columns together for me. I have a School Name column and a Academic Year column. Each school has multiple years associated with it but they are all separate:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example: School 1/ 2018-2019&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; School 1/ 2013-2014&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like for SAS to give me a combined list in the form this format: School 1/&amp;nbsp; 2013-2014,2018-2019 and so on. Is this possible?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jul 2019 19:57:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-matching-two-columns-together/m-p/577068#M13141</guid>
      <dc:creator>UMR13</dc:creator>
      <dc:date>2019-07-26T19:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: SAS matching two columns together</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-matching-two-columns-together/m-p/577069#M13142</link>
      <description>Yes it's possible. If you need help on how to do so please provide some more details on what your input data looks like and what you expect as output. Sample data helps a lot.</description>
      <pubDate>Fri, 26 Jul 2019 20:00:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-matching-two-columns-together/m-p/577069#M13142</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-26T20:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: SAS matching two columns together</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-matching-two-columns-together/m-p/577074#M13143</link>
      <description>&lt;P&gt;I have added a SAS Capture of what it looks like at this moment. I would like for example all the years to be in one cell together with one school.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example: ADA Merritt K-8 Center in one cell with no duplicates and the years all in one cell as 2010-2011,2011-2012,2012-2013, etc... all in one cell.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jul 2019 20:12:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-matching-two-columns-together/m-p/577074#M13143</guid>
      <dc:creator>UMR13</dc:creator>
      <dc:date>2019-07-26T20:12:39Z</dc:date>
    </item>
    <item>
      <title>Re: SAS matching two columns together</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-matching-two-columns-together/m-p/577076#M13144</link>
      <description>Sorry, can't open attachments, someone else will have to help &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;</description>
      <pubDate>Fri, 26 Jul 2019 20:20:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-matching-two-columns-together/m-p/577076#M13144</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-26T20:20:40Z</dc:date>
    </item>
    <item>
      <title>Re: SAS matching two columns together</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-matching-two-columns-together/m-p/577114#M13145</link>
      <description>&lt;PRE&gt;proc sql;
   create table temp as
   select distinct School_name, Academic_year
   from have
   order by School_name, Academic_year
   ;
quit;

Proc transpose data=temp out=trans;
   by school_name;
   var Academic_year;
run;

data want; 
   set trans;
   length Yearlist $ 200; /* this needs to be set long enough to hold longest expected list which would be roughly 10 times the numer of academic years 
that might be involved)
   Yearlist = catx(',', of col: );
   drop col: ;
run;
&lt;/PRE&gt;
&lt;P&gt;This code is using a variable list Col: which means all of the variables whose names start with Col . The colon must be immediately after the last letter of the name stem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The length of the yearlist is # of academic years* (9 +1) . The 9 is how many characters to hold something like 2016-2017, plus 1 for the comma =&amp;gt;10* the number of academic years that might be involved. Look at the TRANS set to see how many years. There will be variables named COL1 -COLn, one for each year. The school with the most years will set the maximum number of years.&lt;/P&gt;
&lt;P&gt;Untested because no actual data set provided.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jul 2019 23:16:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-matching-two-columns-together/m-p/577114#M13145</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-07-26T23:16:06Z</dc:date>
    </item>
  </channel>
</rss>

