<?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: Labels in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Labels-Recoding-variables/m-p/319776#M70331</link>
    <description>Could you please post your code or screenshot of the code.</description>
    <pubDate>Sun, 18 Dec 2016 03:59:01 GMT</pubDate>
    <dc:creator>Jagadishkatam</dc:creator>
    <dc:date>2016-12-18T03:59:01Z</dc:date>
    <item>
      <title>Labels - Recoding variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Labels-Recoding-variables/m-p/319770#M70328</link>
      <description>&lt;P&gt;I know you can change the lables for variables but how do I change record values?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, I have a variable named state and then the abbreviations for 50 states, how can I change and label them to the full name?&lt;/P&gt;
&lt;P&gt;Ex: CA = California&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Dec 2016 06:01:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Labels-Recoding-variables/m-p/319770#M70328</guid>
      <dc:creator>sconn</dc:creator>
      <dc:date>2016-12-18T06:01:40Z</dc:date>
    </item>
    <item>
      <title>Re: Labels</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Labels-Recoding-variables/m-p/319772#M70329</link>
      <description>&lt;P&gt;There are different approaches to change the variable values, either you could try with if then else condition or simply using the format&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;example1: if then else&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data want;
set have;
if var='CA' then var1='California';
else if var='TX' then var1='Texas';
run;

example 2: with format, we need to create the format first and to the same variable we could apply that format with format statement.

proc format;
value $states
'CA'='California'
'TX'='Texas';
run;

data want;
set have;
format var $states.;
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 18 Dec 2016 03:24:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Labels-Recoding-variables/m-p/319772#M70329</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2016-12-18T03:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Labels</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Labels-Recoding-variables/m-p/319774#M70330</link>
      <description>&lt;P&gt;thanks Jag,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did this and no errors came up but it did not seem to change in the tables or dataset. Thank you for your help!&lt;/P&gt;</description>
      <pubDate>Sun, 18 Dec 2016 03:45:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Labels-Recoding-variables/m-p/319774#M70330</guid>
      <dc:creator>sconn</dc:creator>
      <dc:date>2016-12-18T03:45:15Z</dc:date>
    </item>
    <item>
      <title>Re: Labels</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Labels-Recoding-variables/m-p/319776#M70331</link>
      <description>Could you please post your code or screenshot of the code.</description>
      <pubDate>Sun, 18 Dec 2016 03:59:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Labels-Recoding-variables/m-p/319776#M70331</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2016-12-18T03:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: Labels</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Labels-Recoding-variables/m-p/319777#M70332</link>
      <description>&lt;P&gt;proc format;&lt;BR /&gt;value $states&lt;BR /&gt;'MA'='Massachusetts'&lt;BR /&gt;'CT'='Connecticut'&lt;BR /&gt;'NH'='New Hampshire'&lt;BR /&gt;'VT'='Vermont'&lt;BR /&gt;'ME'='Maine'&lt;BR /&gt;'RI'='Rhode Island';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data Final;&lt;BR /&gt;set Final3;&lt;BR /&gt;format var $states.;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Dec 2016 04:04:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Labels-Recoding-variables/m-p/319777#M70332</guid>
      <dc:creator>sconn</dc:creator>
      <dc:date>2016-12-18T04:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: Labels</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Labels-Recoding-variables/m-p/319781#M70334</link>
      <description>what is the variable in final3 dataset which has the values as MA,CT,NH. you have to mention that variable name in the format statement replacing the 'var' in data step.</description>
      <pubDate>Sun, 18 Dec 2016 05:11:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Labels-Recoding-variables/m-p/319781#M70334</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2016-12-18T05:11:55Z</dc:date>
    </item>
    <item>
      <title>Re: Labels</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Labels-Recoding-variables/m-p/319783#M70335</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/120074"&gt;@sconn&lt;/a&gt;&amp;nbsp;Your code appears correct but note that a format changes how a variable is displayed but not the underlying value.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, if it's not working, your starting point isn't necessarily what you think, IE CA isn't CA but something else.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Look at a proc contents of your dataset before and after you apply the format and try the IF version.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Post the proc contents if you need help debugging.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Dec 2016 05:47:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Labels-Recoding-variables/m-p/319783#M70335</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-18T05:47:30Z</dc:date>
    </item>
    <item>
      <title>Re: Labels - Recoding variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Labels-Recoding-variables/m-p/319831#M70352</link>
      <description>&lt;PRE&gt;
Check STNAME(). 


state=stname('NC');
put state; NORTH CAROLINA
state=stnamel('NC');
put state; North Carolina



&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Dec 2016 02:35:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Labels-Recoding-variables/m-p/319831#M70352</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-12-19T02:35:58Z</dc:date>
    </item>
  </channel>
</rss>

