<?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 How to use SSN format in Developers</title>
    <link>https://communities.sas.com/t5/Developers/How-to-use-SSN-format/m-p/5168#M2055</link>
    <description>In a stored process I'm making, I have a character field coming in that contains Social Security numbers.  Can I use the format=SSN11. format line against it, or does my character field have to be converted to numeric first?&lt;BR /&gt;
&lt;BR /&gt;
Second question: In Proc Sql, can I use an input command (XYZ=INPUT(ABC,$11) to convert the character field to numeric, or does that have to be done in a data step?&lt;BR /&gt;
&lt;BR /&gt;
Is there an "easy" way to do what I'm trying to accomplish?&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance so much!</description>
    <pubDate>Tue, 23 Oct 2007 14:58:34 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2007-10-23T14:58:34Z</dc:date>
    <item>
      <title>How to use SSN format</title>
      <link>https://communities.sas.com/t5/Developers/How-to-use-SSN-format/m-p/5168#M2055</link>
      <description>In a stored process I'm making, I have a character field coming in that contains Social Security numbers.  Can I use the format=SSN11. format line against it, or does my character field have to be converted to numeric first?&lt;BR /&gt;
&lt;BR /&gt;
Second question: In Proc Sql, can I use an input command (XYZ=INPUT(ABC,$11) to convert the character field to numeric, or does that have to be done in a data step?&lt;BR /&gt;
&lt;BR /&gt;
Is there an "easy" way to do what I'm trying to accomplish?&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance so much!</description>
      <pubDate>Tue, 23 Oct 2007 14:58:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-to-use-SSN-format/m-p/5168#M2055</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-10-23T14:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SSN format</title>
      <link>https://communities.sas.com/t5/Developers/How-to-use-SSN-format/m-p/5169#M2056</link>
      <description>&lt;P&gt;Hi:&lt;BR /&gt; Look in the documentation for the topics:&lt;BR /&gt; Functions and CALL Routines &lt;BR /&gt; INPUT Function&lt;BR /&gt; &lt;BR /&gt; The bottom line is that to convert a CHARACTER variable to a number, you use the INPUT function like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;newnumvar = INPUT(oldcharvar,numeric-informat.); (DATA step)
OR
INPUT(oldcharvar,numeric-informat.) as newnumvar (SQL)&lt;/PRE&gt;
&lt;P&gt;So you were ALMOST right in your INPUT statement. Think of it this way, in order to turn your old character variable into a NEW numeric variable, you have to give the NUMERIC INformat to use.&lt;BR /&gt; &lt;BR /&gt; See the example below.&lt;BR /&gt; cynthia&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;** make some data;
** ssnc is a 9 position character variable with SSN;
** ssn is a numeric variable;
data testit;
name = 'alan';
ssn = 123456789;
ssnc = '123456789';
output;

name = 'bob';
ssn = 002334444;
ssnc = '002334444';
output;
run;

ods listing;

proc sql ;
select name, ssn format=ssn11., ssnc,
input(ssnc,9.) as newssn format=ssn11.
from work.testit;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt; and the output:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;name ssn ssnc newssn
-----------------------------------------
alan 123-45-6789 123456789 123-45-6789
bob 002-33-4444 002334444 002-33-4444
&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Sep 2016 19:25:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-to-use-SSN-format/m-p/5169#M2056</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-09-01T19:25:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SSN format</title>
      <link>https://communities.sas.com/t5/Developers/How-to-use-SSN-format/m-p/5170#M2057</link>
      <description>So close, yet so far!  Thanks for the information..... that'll come in handy for many Proc Sql's to come.</description>
      <pubDate>Tue, 23 Oct 2007 18:30:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-to-use-SSN-format/m-p/5170#M2057</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-10-23T18:30:40Z</dc:date>
    </item>
  </channel>
</rss>

