<?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: Create new variables based on value of another variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-new-variables-based-on-value-of-another-variable/m-p/9174#M429</link>
    <description>Hi Nick R,&lt;BR /&gt;
&lt;BR /&gt;
Thanks for your suggestion.&lt;BR /&gt;
&lt;BR /&gt;
That works for me, now to integrate it into my job.</description>
    <pubDate>Mon, 14 Feb 2011 04:30:01 GMT</pubDate>
    <dc:creator>JohnT</dc:creator>
    <dc:date>2011-02-14T04:30:01Z</dc:date>
    <item>
      <title>Create new variables based on value of another variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-new-variables-based-on-value-of-another-variable/m-p/9172#M427</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I have some data in which I want to conver the value of some variables into new variables.&lt;BR /&gt;
&lt;BR /&gt;
Here's some data:&lt;BR /&gt;
[pre]   data tmp;&lt;BR /&gt;
   input AMT01	AMT02	AMT03	AMT04	CODE01 $	CODE02 $	CODE03 $	CODE04 $;&lt;BR /&gt;
   datalines;&lt;BR /&gt;
   100	200	500	400	AB	CD	EF	GH&lt;BR /&gt;
   100	200	500	400	AB	CD	IJ	KL&lt;BR /&gt;
   100	200	500	400	AB	EF	IJ	KL&lt;BR /&gt;
   ;&lt;BR /&gt;
   run;[/pre]&lt;BR /&gt;
&lt;BR /&gt;
And here's how the table looks:&lt;BR /&gt;
[pre]	AMT01	AMT02	AMT03	AMT04	CODE01	CODE02	CODE03	CODE04&lt;BR /&gt;
	100	200	500	400	AB	CD	EF	GH&lt;BR /&gt;
	100	200	500	400	AB	CD	IJ	KL&lt;BR /&gt;
	100	200	500	400	AB	EF	IJ	KL[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Here's how I want that data to look:&lt;BR /&gt;
[pre]	AB	CD	EF	GH	IJ	KL&lt;BR /&gt;
	100	200	500	400	.	.&lt;BR /&gt;
	100	200	.	.	500	400&lt;BR /&gt;
	100	.	200	.	500	400[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Is there some simple method of creating the variable names without using macros?  Hopefully with a function?  &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks.

Message was edited by: John T</description>
      <pubDate>Sun, 13 Feb 2011 22:50:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-new-variables-based-on-value-of-another-variable/m-p/9172#M427</guid>
      <dc:creator>JohnT</dc:creator>
      <dc:date>2011-02-13T22:50:46Z</dc:date>
    </item>
    <item>
      <title>Re: Create new variables based on value of another variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-new-variables-based-on-value-of-another-variable/m-p/9173#M428</link>
      <description>data tmp1;&lt;BR /&gt;
length code $8;&lt;BR /&gt;
	set tmp;&lt;BR /&gt;
	ord=_n_;&lt;BR /&gt;
	amt=amt01;&lt;BR /&gt;
	code=code01;&lt;BR /&gt;
	output;&lt;BR /&gt;
	amt=amt02;&lt;BR /&gt;
	code=code02;&lt;BR /&gt;
	output;&lt;BR /&gt;
	amt=amt03;&lt;BR /&gt;
	code=code03;&lt;BR /&gt;
	output;&lt;BR /&gt;
	amt=amt04;&lt;BR /&gt;
	code=code04;&lt;BR /&gt;
	output;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc transpose data=tmp1 out=tmp2(drop=ord _name_);&lt;BR /&gt;
	id code;&lt;BR /&gt;
	var amt;&lt;BR /&gt;
	by ord;&lt;BR /&gt;
run;</description>
      <pubDate>Mon, 14 Feb 2011 03:55:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-new-variables-based-on-value-of-another-variable/m-p/9173#M428</guid>
      <dc:creator>NickR</dc:creator>
      <dc:date>2011-02-14T03:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: Create new variables based on value of another variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-new-variables-based-on-value-of-another-variable/m-p/9174#M429</link>
      <description>Hi Nick R,&lt;BR /&gt;
&lt;BR /&gt;
Thanks for your suggestion.&lt;BR /&gt;
&lt;BR /&gt;
That works for me, now to integrate it into my job.</description>
      <pubDate>Mon, 14 Feb 2011 04:30:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-new-variables-based-on-value-of-another-variable/m-p/9174#M429</guid>
      <dc:creator>JohnT</dc:creator>
      <dc:date>2011-02-14T04:30:01Z</dc:date>
    </item>
  </channel>
</rss>

