<?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: change variable name in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/change-variable-name/m-p/32707#M7909</link>
    <description>No.&lt;BR /&gt;
For the previous SAS release,the number of variables is limited for proc transpose.I am not sure the Current SAS is whether supported unlimited variables.&lt;BR /&gt;
&lt;BR /&gt;
Ksharp

Message was edited by: Ksharp</description>
    <pubDate>Fri, 12 Nov 2010 05:45:58 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2010-11-12T05:45:58Z</dc:date>
    <item>
      <title>change variable name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/change-variable-name/m-p/32704#M7906</link>
      <description>suppose I have two data set:&lt;BR /&gt;
&lt;BR /&gt;
data_set_1:&lt;BR /&gt;
&lt;BR /&gt;
obs		Var_1	Var_2	Var_3&lt;BR /&gt;
1		002		003		001&lt;BR /&gt;
2		1.02	0.09	0.23&lt;BR /&gt;
3		0.02	0.56	1.08&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data_set_2:&lt;BR /&gt;
&lt;BR /&gt;
obs		ID		Name&lt;BR /&gt;
1		001		Math&lt;BR /&gt;
2		002		Phys&lt;BR /&gt;
3		003		Chem&lt;BR /&gt;
&lt;BR /&gt;
Now I want to create Data_Set_3 using following criteria:&lt;BR /&gt;
Compare the first obs of data_set_1 with ID variables of data_set_2. If the result is same, the variable name of data_set_1 will change to the name of Name variables in data_set_2.&lt;BR /&gt;
&lt;BR /&gt;
I hope I explained my question clearly. And the expected data_set_3 will be like:&lt;BR /&gt;
&lt;BR /&gt;
data_set_3:&lt;BR /&gt;
&lt;BR /&gt;
obs		Phys	Chem	Math&lt;BR /&gt;
1		002		003		001&lt;BR /&gt;
2		1.02	0.09	0.23&lt;BR /&gt;
3		0.02	0.56	1.08&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Is there a easy way to do this? Thanks.</description>
      <pubDate>Thu, 11 Nov 2010 22:14:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/change-variable-name/m-p/32704#M7906</guid>
      <dc:creator>newhand</dc:creator>
      <dc:date>2010-11-11T22:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: change variable name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/change-variable-name/m-p/32705#M7907</link>
      <description>Yes.&lt;BR /&gt;
There is an easy way to do this .&lt;BR /&gt;
But this way is not suitable for the dataset with large obs.&lt;BR /&gt;
[pre]&lt;BR /&gt;
data data1;&lt;BR /&gt;
 input obs (var1 var2 var3) ($);&lt;BR /&gt;
datalines;&lt;BR /&gt;
1 002 003 001&lt;BR /&gt;
2 1.02 0.09 0.23&lt;BR /&gt;
3 0.02 0.56 1.08&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data data2;&lt;BR /&gt;
 input obs id $ name $;&lt;BR /&gt;
datalines;&lt;BR /&gt;
1 001 Math&lt;BR /&gt;
2 002 Phys&lt;BR /&gt;
3 003 Chem&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
proc transpose data=data1(drop=obs) out=temp;&lt;BR /&gt;
 var var1 var2 var3;&lt;BR /&gt;
run;&lt;BR /&gt;
proc sort data=temp;&lt;BR /&gt;
 by col1;&lt;BR /&gt;
run;&lt;BR /&gt;
proc sort data=data2(drop=obs);&lt;BR /&gt;
 by id;&lt;BR /&gt;
run;&lt;BR /&gt;
data result;&lt;BR /&gt;
 merge temp(rename=(col1=id)) data2;&lt;BR /&gt;
 by id;&lt;BR /&gt;
 drop _name_;&lt;BR /&gt;
run;&lt;BR /&gt;
proc transpose data=result out=op(drop=_name_);&lt;BR /&gt;
 id name;&lt;BR /&gt;
 var  id col2 col3;&lt;BR /&gt;
run;&lt;BR /&gt;
proc print ; run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Fri, 12 Nov 2010 02:20:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/change-variable-name/m-p/32705#M7907</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-11-12T02:20:52Z</dc:date>
    </item>
    <item>
      <title>Re: change variable name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/change-variable-name/m-p/32706#M7908</link>
      <description>thank you, Ksharp.&lt;BR /&gt;
&lt;BR /&gt;
Is it because "Transpose" will take too much time that this method is not suitable for dataset with too many obs?</description>
      <pubDate>Fri, 12 Nov 2010 02:56:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/change-variable-name/m-p/32706#M7908</guid>
      <dc:creator>newhand</dc:creator>
      <dc:date>2010-11-12T02:56:39Z</dc:date>
    </item>
    <item>
      <title>Re: change variable name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/change-variable-name/m-p/32707#M7909</link>
      <description>No.&lt;BR /&gt;
For the previous SAS release,the number of variables is limited for proc transpose.I am not sure the Current SAS is whether supported unlimited variables.&lt;BR /&gt;
&lt;BR /&gt;
Ksharp

Message was edited by: Ksharp</description>
      <pubDate>Fri, 12 Nov 2010 05:45:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/change-variable-name/m-p/32707#M7909</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-11-12T05:45:58Z</dc:date>
    </item>
  </channel>
</rss>

