<?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: Matching Variables in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Matching-Variables/m-p/56612#M15813</link>
    <description>Explore using SAS PROC TRANSPOSE.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
    <pubDate>Tue, 21 Jul 2009 03:09:52 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2009-07-21T03:09:52Z</dc:date>
    <item>
      <title>Matching Variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Matching-Variables/m-p/56611#M15812</link>
      <description>Hi all,&lt;BR /&gt;
&lt;BR /&gt;
What is the method for matching observations in two columns in a dataset, to create an output dataset? For example, I have:&lt;BR /&gt;
&lt;BR /&gt;
&lt;U&gt;SURVEY_ID	YEAR	BUDGET&lt;/U&gt;&lt;BR /&gt;
1	                 1993	7.21&lt;BR /&gt;
1	                 1996	5&lt;BR /&gt;
1	                 1998	4.51&lt;BR /&gt;
2	                 1997	3.76&lt;BR /&gt;
2	                 1996	3.81&lt;BR /&gt;
2	                 1993	4.98&lt;BR /&gt;
3	                 1998	3.79&lt;BR /&gt;
3	                 1994	5.01&lt;BR /&gt;
3	                 1995	3.87&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
and I want the output dataset to look as below: (matching years with the budgets)&lt;BR /&gt;
&lt;BR /&gt;
&lt;U&gt;SURVEY_ID	1993	1994	1995	1996	1997	1998&lt;/U&gt;&lt;BR /&gt;
1	                 7.21			    5		4.51&lt;BR /&gt;
2	                 4.98			3.81	3.76	&lt;BR /&gt;
3		                  5.01  3.87		3.79&lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;&lt;/B&gt;&lt;B&gt;&lt;/B&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks....</description>
      <pubDate>Tue, 21 Jul 2009 01:52:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Matching-Variables/m-p/56611#M15812</guid>
      <dc:creator>spg</dc:creator>
      <dc:date>2009-07-21T01:52:18Z</dc:date>
    </item>
    <item>
      <title>Re: Matching Variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Matching-Variables/m-p/56612#M15813</link>
      <description>Explore using SAS PROC TRANSPOSE.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 21 Jul 2009 03:09:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Matching-Variables/m-p/56612#M15813</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-07-21T03:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: Matching Variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Matching-Variables/m-p/56613#M15814</link>
      <description>I have tried the PROC TRANSPOSE before. The problem in using this is that the set of years for each ID is not the same. As a result, if I do Proc Transpose, the format of the ouput table is completely upset.&lt;BR /&gt;
&lt;BR /&gt;
The PROC TRANSPOSE procedure will work only if I can include the range of years against each ID, so that every ID has the same number and range of years, but with missing budgets in some years.&lt;BR /&gt;
&lt;BR /&gt;
Help!</description>
      <pubDate>Tue, 21 Jul 2009 03:58:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Matching-Variables/m-p/56613#M15814</guid>
      <dc:creator>spg</dc:creator>
      <dc:date>2009-07-21T03:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: Matching Variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Matching-Variables/m-p/56614#M15815</link>
      <description>Hello STBee.&lt;BR /&gt;
&lt;BR /&gt;
Have you tried this?&lt;BR /&gt;
&lt;BR /&gt;
proc transpose data = SURVEYS out = SURVEYS_T (drop = _NAME_);&lt;BR /&gt;
by SURVEY_ID;&lt;BR /&gt;
id YEAR;&lt;BR /&gt;
var BUDGET;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Because (unless I got it wrong) for me it is producing exactly what you described (matching years with the budget):&lt;BR /&gt;
&lt;BR /&gt;
SURVEY_ID _1993 _1996 _1998 _1997 _1994 _1995&lt;BR /&gt;
1 7.21 5.00 4.51 . . .&lt;BR /&gt;
2 4.98 3.81 . 3.76 . .&lt;BR /&gt;
3 . . 3.79 . 5.01 3.87&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Cheers from Portugal.&lt;BR /&gt;
&lt;BR /&gt;
Daniel Santos @ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;.</description>
      <pubDate>Tue, 21 Jul 2009 07:49:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Matching-Variables/m-p/56614#M15815</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2009-07-21T07:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: Matching Variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Matching-Variables/m-p/56615#M15816</link>
      <description>Thank you very much Daniel (and Scott). The code works fine. I just sorted both the IDs and the Years and got the desired output.&lt;BR /&gt;
&lt;BR /&gt;
It was a huge help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Tue, 21 Jul 2009 14:24:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Matching-Variables/m-p/56615#M15816</guid>
      <dc:creator>spg</dc:creator>
      <dc:date>2009-07-21T14:24:06Z</dc:date>
    </item>
  </channel>
</rss>

