<?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: trying to convert a Character variables to numeric for proc corr analysis in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/trying-to-convert-a-Character-variables-to-numeric-for-proc-corr/m-p/461807#M70364</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I mdofied my previous codes and divided the states into&amp;nbsp; 4 Regions, but its generating a character missing values.&lt;/P&gt;&lt;P&gt;any inputs will be appreciated and also can i change the new variable STATECOD_1 to Numeric Type.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks kindly&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data sas_pr.merge_4;&lt;BR /&gt;set sas_pr.merge_3;&lt;BR /&gt;length STATECOD_1 $ 14;&lt;BR /&gt;if STATECOD = in('CT', 'ME','MA','NH','RI','VT','NJ','NY','PA')&lt;BR /&gt;THEN STATECOD_1 = 'Region_1';&lt;BR /&gt;if STATECOD = in('IL','IN','MI','OH','WI','IA','KS','MN','MO','NE','ND','SD')&lt;BR /&gt;THEN STATECOD_1 = 'Region_2';&lt;BR /&gt;if STATECOD = in('DE','FL','GA','MD','NC','SC','VA','DC','WV','AL','KY','MS','TN','AR','LA','OK','TX')&lt;BR /&gt;THEN STATECOD_1 = 'Region_3';&lt;BR /&gt;if STATECOD = in('AZ','CO','ID','MT','NV','NM','UT','WY','AK','CA','HI','OR','WA')&lt;BR /&gt;THEN STATECOD_1 = 'Region_4';&lt;BR /&gt;RUN;&lt;/P&gt;</description>
    <pubDate>Sat, 12 May 2018 22:51:38 GMT</pubDate>
    <dc:creator>azhar7860</dc:creator>
    <dc:date>2018-05-12T22:51:38Z</dc:date>
    <item>
      <title>trying to convert a Character variables to numeric for proc corr analysis</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/trying-to-convert-a-Character-variables-to-numeric-for-proc-corr/m-p/461699#M70359</link>
      <description>&lt;DIV&gt;&amp;nbsp; &amp;nbsp;I am working on SAS&amp;nbsp; dataset consists of 31 variables and 164,450 obs.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;And there are 2 to 3 character variables, iam trying to convert them into numeric to check correlation using proc cor.&lt;/DIV&gt;&lt;DIV&gt;i have written a code its very generic would you suggest any smart code.&lt;/DIV&gt;&lt;DIV&gt;Any suggestion will be highly appreciated&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks Kindly&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;Here is my code:&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;data all;&lt;/DIV&gt;&lt;DIV&gt;set all;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="AE" then state =1 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="AK" then state =2 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="AL" then state =3 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="AP" then state =4 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="AR" then state =5 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="AZ" then state =6 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="CA" then state =7 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="CO" then state =8 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="CT" then state =9 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="DC" then state =10 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="DE" then state =11 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="FL" then state =12 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="GA" then state =13 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="HI" then state =14 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="IA" then state =15 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="ID" then state =16 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="IL" then state =17 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="IN" then state =18 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="KS" then state =19 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="KY" then state =20 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="LA" then state =21 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="MA" then state =22 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="MD" then state =23 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="ME" then state =24 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="MI" then state =25 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="MN" then state =26 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="MO" then state =27 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="MS" then state =28 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="MT" then state =29 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="NC" then state =30 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="ND" then state =31 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="NE" then state =32 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="NH" then state =33 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="NJ" then state =34 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="NM" then state =35 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="NV" then state =36 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="NY" then state =37 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="OH" then state =38 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="OK" then state =39 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="OR" then state =40 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="PA" then state =41 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="PR" then state =42 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="RI" then state =43 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="SC" then state =44 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="SD" then state =45 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="TN" then state =46 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="TX" then state =47 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="UT" then state =48 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="VA" then state =49 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="VI" then state =50 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="VT" then state =51 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="WA" then state =52 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="WI" then state =53 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="WV" then state =54 ;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; STATECOD ="WY" then state =55 ;&lt;/DIV&gt;&lt;DIV&gt;run;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;data all;&lt;/DIV&gt;&lt;DIV&gt;set all;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; NTITLE ="Mr" then title =1;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; NTITLE ="Mrs" then title =2;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; NTITLE ="Ms" then title =3;&lt;/DIV&gt;&lt;DIV&gt;if&amp;nbsp; NTITLE ="None" then title =4;&lt;/DIV&gt;&lt;DIV&gt;run;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 11 May 2018 20:34:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/trying-to-convert-a-Character-variables-to-numeric-for-proc-corr/m-p/461699#M70359</guid>
      <dc:creator>azhar7860</dc:creator>
      <dc:date>2018-05-11T20:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: trying to convert a Character variables to numeric for proc corr analysis</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/trying-to-convert-a-Character-variables-to-numeric-for-proc-corr/m-p/461708#M70360</link>
      <description>Create look up tables with these mappings. &lt;BR /&gt;You can use that either to join with your original table, or as source for creating SAS formats, which you later can use to transform your values.</description>
      <pubDate>Fri, 11 May 2018 21:12:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/trying-to-convert-a-Character-variables-to-numeric-for-proc-corr/m-p/461708#M70360</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2018-05-11T21:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: trying to convert a Character variables to numeric for proc corr analysis</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/trying-to-convert-a-Character-variables-to-numeric-for-proc-corr/m-p/461717#M70361</link>
      <description>&lt;P&gt;See if&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;State= stfips(statecod);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;looks helpful.&lt;/P&gt;
&lt;P&gt;Though I am wondering what "state" is represented by "AE", "AP" ???&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;FIPS is a US standard for certain types of coding and SAS has a number of functions that support such things.&lt;/P&gt;
&lt;P&gt;Also this function will accept mixed case in case some of your values are "Al" instead of "AL".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The values won't exactly align but have the added value that they are a known standard and you can retrieve information from then with functions such as FIPNAME or FIPNAMEL or FIPSTATE.&lt;/P&gt;</description>
      <pubDate>Fri, 11 May 2018 22:00:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/trying-to-convert-a-Character-variables-to-numeric-for-proc-corr/m-p/461717#M70361</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-05-11T22:00:14Z</dc:date>
    </item>
    <item>
      <title>Re: trying to convert a Character variables to numeric for proc corr analysis</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/trying-to-convert-a-Character-variables-to-numeric-for-proc-corr/m-p/461763#M70362</link>
      <description>&lt;P&gt;What &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH&lt;/a&gt;&amp;nbsp;means might look like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data myformat;
input start $ label $
fmtname = 'mystates';
type = 'C';
datalines;
AE 1
AK 2
AL 3
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can join along start, or use it as a cntlin for proc format; note how the datalines reduce your typing effort.&lt;/P&gt;</description>
      <pubDate>Sat, 12 May 2018 08:08:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/trying-to-convert-a-Character-variables-to-numeric-for-proc-corr/m-p/461763#M70362</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-05-12T08:08:41Z</dc:date>
    </item>
    <item>
      <title>Re: trying to convert a Character variables to numeric for proc corr analysis</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/trying-to-convert-a-Character-variables-to-numeric-for-proc-corr/m-p/461807#M70364</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I mdofied my previous codes and divided the states into&amp;nbsp; 4 Regions, but its generating a character missing values.&lt;/P&gt;&lt;P&gt;any inputs will be appreciated and also can i change the new variable STATECOD_1 to Numeric Type.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks kindly&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data sas_pr.merge_4;&lt;BR /&gt;set sas_pr.merge_3;&lt;BR /&gt;length STATECOD_1 $ 14;&lt;BR /&gt;if STATECOD = in('CT', 'ME','MA','NH','RI','VT','NJ','NY','PA')&lt;BR /&gt;THEN STATECOD_1 = 'Region_1';&lt;BR /&gt;if STATECOD = in('IL','IN','MI','OH','WI','IA','KS','MN','MO','NE','ND','SD')&lt;BR /&gt;THEN STATECOD_1 = 'Region_2';&lt;BR /&gt;if STATECOD = in('DE','FL','GA','MD','NC','SC','VA','DC','WV','AL','KY','MS','TN','AR','LA','OK','TX')&lt;BR /&gt;THEN STATECOD_1 = 'Region_3';&lt;BR /&gt;if STATECOD = in('AZ','CO','ID','MT','NV','NM','UT','WY','AK','CA','HI','OR','WA')&lt;BR /&gt;THEN STATECOD_1 = 'Region_4';&lt;BR /&gt;RUN;&lt;/P&gt;</description>
      <pubDate>Sat, 12 May 2018 22:51:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/trying-to-convert-a-Character-variables-to-numeric-for-proc-corr/m-p/461807#M70364</guid>
      <dc:creator>azhar7860</dc:creator>
      <dc:date>2018-05-12T22:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: trying to convert a Character variables to numeric for proc corr analysis</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/trying-to-convert-a-Character-variables-to-numeric-for-proc-corr/m-p/461819#M70365</link>
      <description>&lt;P&gt;There should be no equal sign between STATECOD and IN(...).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;if STATECOD IN(....) then ....;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 13 May 2018 04:51:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/trying-to-convert-a-Character-variables-to-numeric-for-proc-corr/m-p/461819#M70365</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-05-13T04:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: trying to convert a Character variables to numeric for proc corr analysis</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/trying-to-convert-a-Character-variables-to-numeric-for-proc-corr/m-p/461820#M70366</link>
      <description>Thanks kindly&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 13 May 2018 05:16:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/trying-to-convert-a-Character-variables-to-numeric-for-proc-corr/m-p/461820#M70366</guid>
      <dc:creator>azhar7860</dc:creator>
      <dc:date>2018-05-13T05:16:33Z</dc:date>
    </item>
    <item>
      <title>Re: trying to convert a Character variables to numeric for proc corr analysis</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/trying-to-convert-a-Character-variables-to-numeric-for-proc-corr/m-p/462079#M70382</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/172715"&gt;@azhar7860&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I mdofied my previous codes and divided the states into&amp;nbsp; 4 Regions, but its generating a character missing values.&lt;/P&gt;
&lt;P&gt;any inputs will be appreciated and also can i change the new variable STATECOD_1 to Numeric Type.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks kindly&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data sas_pr.merge_4;&lt;BR /&gt;set sas_pr.merge_3;&lt;BR /&gt;length STATECOD_1 $ 14;&lt;BR /&gt;if STATECOD = in('CT', 'ME','MA','NH','RI','VT','NJ','NY','PA')&lt;BR /&gt;THEN STATECOD_1 = 'Region_1';&lt;BR /&gt;if STATECOD = in('IL','IN','MI','OH','WI','IA','KS','MN','MO','NE','ND','SD')&lt;BR /&gt;THEN STATECOD_1 = 'Region_2';&lt;BR /&gt;if STATECOD = in('DE','FL','GA','MD','NC','SC','VA','DC','WV','AL','KY','MS','TN','AR','LA','OK','TX')&lt;BR /&gt;THEN STATECOD_1 = 'Region_3';&lt;BR /&gt;if STATECOD = in('AZ','CO','ID','MT','NV','NM','UT','WY','AK','CA','HI','OR','WA')&lt;BR /&gt;THEN STATECOD_1 = 'Region_4';&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I notice AE AP VI PR&amp;nbsp; are no longer involved ...&lt;/P&gt;</description>
      <pubDate>Mon, 14 May 2018 15:19:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/trying-to-convert-a-Character-variables-to-numeric-for-proc-corr/m-p/462079#M70382</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-05-14T15:19:38Z</dc:date>
    </item>
    <item>
      <title>Re: trying to convert a Character variables to numeric for proc corr analysis</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/trying-to-convert-a-Character-variables-to-numeric-for-proc-corr/m-p/462251#M70393</link>
      <description>Appreciate.&lt;BR /&gt;THANKS KINDLY,&lt;BR /&gt;</description>
      <pubDate>Tue, 15 May 2018 04:06:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/trying-to-convert-a-Character-variables-to-numeric-for-proc-corr/m-p/462251#M70393</guid>
      <dc:creator>azhar7860</dc:creator>
      <dc:date>2018-05-15T04:06:32Z</dc:date>
    </item>
    <item>
      <title>Re: trying to convert a Character variables to numeric for proc corr analysis</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/trying-to-convert-a-Character-variables-to-numeric-for-proc-corr/m-p/462254#M70394</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/172715"&gt;@azhar7860&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I mdofied my previous codes and divided the states into&amp;nbsp; 4 Regions, but its generating a character missing values.&lt;/P&gt;
&lt;P&gt;any inputs will be appreciated and also can i change the new variable STATECOD_1 to Numeric Type.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks kindly&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data sas_pr.merge_4;&lt;BR /&gt;set sas_pr.merge_3;&lt;BR /&gt;length STATECOD_1 $ 14;&lt;BR /&gt;if STATECOD = in('CT', 'ME','MA','NH','RI','VT','NJ','NY','PA')&lt;BR /&gt;THEN STATECOD_1 = 'Region_1';&lt;BR /&gt;if STATECOD = in('IL','IN','MI','OH','WI','IA','KS','MN','MO','NE','ND','SD')&lt;BR /&gt;THEN STATECOD_1 = 'Region_2';&lt;BR /&gt;if STATECOD = in('DE','FL','GA','MD','NC','SC','VA','DC','WV','AL','KY','MS','TN','AR','LA','OK','TX')&lt;BR /&gt;THEN STATECOD_1 = 'Region_3';&lt;BR /&gt;if STATECOD = in('AZ','CO','ID','MT','NV','NM','UT','WY','AK','CA','HI','OR','WA')&lt;BR /&gt;THEN STATECOD_1 = 'Region_4';&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Once again, create a lookup dataset and a format from that, and the cards section will look like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;cards;
CT Region_1
ME Region_1
.....
IL Region_2
IN Region_2&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and so on.&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2018 04:26:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/trying-to-convert-a-Character-variables-to-numeric-for-proc-corr/m-p/462254#M70394</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-05-15T04:26:12Z</dc:date>
    </item>
  </channel>
</rss>

