<?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: simple conversion of character variables in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/simple-conversion-of-character-variables/m-p/12952#M1790</link>
    <description>Just as SBB said.Try this.&lt;BR /&gt;
[pre]&lt;BR /&gt;
data a;&lt;BR /&gt;
 input x $;&lt;BR /&gt;
datalines;&lt;BR /&gt;
a&lt;BR /&gt;
a&lt;BR /&gt;
a&lt;BR /&gt;
a&lt;BR /&gt;
c&lt;BR /&gt;
c&lt;BR /&gt;
b&lt;BR /&gt;
b&lt;BR /&gt;
b&lt;BR /&gt;
d&lt;BR /&gt;
d&lt;BR /&gt;
e&lt;BR /&gt;
;&lt;BR /&gt;
&lt;BR /&gt;
data b;&lt;BR /&gt;
 set a;&lt;BR /&gt;
 _x=translate(x,'12345','abcde');&lt;BR /&gt;
run;&lt;BR /&gt;
proc print;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
    <pubDate>Mon, 11 Oct 2010 09:06:28 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2010-10-11T09:06:28Z</dc:date>
    <item>
      <title>simple conversion of character variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/simple-conversion-of-character-variables/m-p/12949#M1787</link>
      <description>hello all-&lt;BR /&gt;
&lt;BR /&gt;
say i have a character variable x=(a,a,a,a,c,c,b,b,b,d,d,e) how can i convert this to y=(1,1,1,1,2,2,3,3,3,4,4,5).&lt;BR /&gt;
&lt;BR /&gt;
ive tried the input command but im not sure how to use this. im assuming there must be an easy way to do this&lt;BR /&gt;
&lt;BR /&gt;
cheers</description>
      <pubDate>Wed, 06 Oct 2010 18:56:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/simple-conversion-of-character-variables/m-p/12949#M1787</guid>
      <dc:creator>trekvana</dc:creator>
      <dc:date>2010-10-06T18:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: simple conversion of character variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/simple-conversion-of-character-variables/m-p/12950#M1788</link>
      <description>Look at using the TRANSLATE function - you will need to define argument2 and argument3 with the value mapping/associations.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Wed, 06 Oct 2010 19:01:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/simple-conversion-of-character-variables/m-p/12950#M1788</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-10-06T19:01:59Z</dc:date>
    </item>
    <item>
      <title>Re: simple conversion of character variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/simple-conversion-of-character-variables/m-p/12951#M1789</link>
      <description>I would be inclined to create an custom INFORMAT to do this:&lt;BR /&gt;
&lt;BR /&gt;
proc format;&lt;BR /&gt;
  invalue alpha_order 'A' = 1;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data test;&lt;BR /&gt;
  var = 'A';&lt;BR /&gt;
  var_order = input(var, alpha_order.);&lt;BR /&gt;
  put _all_;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
You could expand this example to cover all 26 alphabet letters, or write a DATA step to generate a PROC FORMAT input dataset automatically.</description>
      <pubDate>Wed, 06 Oct 2010 20:05:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/simple-conversion-of-character-variables/m-p/12951#M1789</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2010-10-06T20:05:14Z</dc:date>
    </item>
    <item>
      <title>Re: simple conversion of character variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/simple-conversion-of-character-variables/m-p/12952#M1790</link>
      <description>Just as SBB said.Try this.&lt;BR /&gt;
[pre]&lt;BR /&gt;
data a;&lt;BR /&gt;
 input x $;&lt;BR /&gt;
datalines;&lt;BR /&gt;
a&lt;BR /&gt;
a&lt;BR /&gt;
a&lt;BR /&gt;
a&lt;BR /&gt;
c&lt;BR /&gt;
c&lt;BR /&gt;
b&lt;BR /&gt;
b&lt;BR /&gt;
b&lt;BR /&gt;
d&lt;BR /&gt;
d&lt;BR /&gt;
e&lt;BR /&gt;
;&lt;BR /&gt;
&lt;BR /&gt;
data b;&lt;BR /&gt;
 set a;&lt;BR /&gt;
 _x=translate(x,'12345','abcde');&lt;BR /&gt;
run;&lt;BR /&gt;
proc print;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Mon, 11 Oct 2010 09:06:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/simple-conversion-of-character-variables/m-p/12952#M1790</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-10-11T09:06:28Z</dc:date>
    </item>
  </channel>
</rss>

