<?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: Conversion From Numeric to Words Format in Indian Currency in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Conversion-From-Numeric-to-Words-Format-in-Indian-Currency/m-p/606789#M17439</link>
    <description>While using PROC FORMAT. It didn't let me choose the same name of the format i.e lakh_words.&lt;BR /&gt;So I used lakh_wordsA.</description>
    <pubDate>Sun, 24 Nov 2019 08:02:05 GMT</pubDate>
    <dc:creator>aashish_jain</dc:creator>
    <dc:date>2019-11-24T08:02:05Z</dc:date>
    <item>
      <title>Conversion From Numeric to Words Format in Indian Currency</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Conversion-From-Numeric-to-Words-Format-in-Indian-Currency/m-p/606436#M17401</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Suppose I have data like this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA HAVE;&lt;/P&gt;&lt;P&gt;X=100000;&lt;/P&gt;&lt;P&gt;Y=1000000;&lt;/P&gt;&lt;P&gt;Z=1500000;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and so on.&lt;/P&gt;&lt;P&gt;I want these numbers to be presented in a word format like&lt;/P&gt;&lt;P&gt;The value of X Would be One Lakh, Y Would be like Ten Lakh&lt;/P&gt;&lt;P&gt;In SAS I have tried WORD. and WORDS. Format,But all these formats are giving Output like&lt;/P&gt;&lt;P&gt;X=one hundred thousand&lt;/P&gt;&lt;P&gt;Y=one million.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also attaching the screenshot of the output from functions I have used i.e. Words.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want the output&amp;nbsp; in Indian Format.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 12:55:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Conversion-From-Numeric-to-Words-Format-in-Indian-Currency/m-p/606436#M17401</guid>
      <dc:creator>aashish_jain</dc:creator>
      <dc:date>2019-11-22T12:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion From Numeric to Words Format in Indian Currency</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Conversion-From-Numeric-to-Words-Format-in-Indian-Currency/m-p/606437#M17402</link>
      <description>&lt;P&gt;Hi and welcome to the SAS Community &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you want to create a new character variable to hold this value or simply format the existing numeric value?&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 12:58:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Conversion-From-Numeric-to-Words-Format-in-Indian-Currency/m-p/606437#M17402</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-11-22T12:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion From Numeric to Words Format in Indian Currency</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Conversion-From-Numeric-to-Words-Format-in-Indian-Currency/m-p/606438#M17403</link>
      <description>You can give either Both are acceptable to me.&lt;BR /&gt;But former would be preferable</description>
      <pubDate>Fri, 22 Nov 2019 13:01:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Conversion-From-Numeric-to-Words-Format-in-Indian-Currency/m-p/606438#M17403</guid>
      <dc:creator>aashish_jain</dc:creator>
      <dc:date>2019-11-22T13:01:01Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion From Numeric to Words Format in Indian Currency</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Conversion-From-Numeric-to-Words-Format-in-Indian-Currency/m-p/606439#M17404</link>
      <description>&lt;P&gt;Using a picture format..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
    picture ind other='00009 Lakh' (mult=.00001);
run;

data have;
    x=100000;
    y=1000000;
    z=1500000;
    format x y z ind.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 13:07:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Conversion-From-Numeric-to-Words-Format-in-Indian-Currency/m-p/606439#M17404</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-11-22T13:07:10Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion From Numeric to Words Format in Indian Currency</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Conversion-From-Numeric-to-Words-Format-in-Indian-Currency/m-p/606442#M17406</link>
      <description>Thank for the Reply .&lt;BR /&gt;But What if X is like&lt;BR /&gt;X=1321462</description>
      <pubDate>Fri, 22 Nov 2019 13:17:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Conversion-From-Numeric-to-Words-Format-in-Indian-Currency/m-p/606442#M17406</guid>
      <dc:creator>aashish_jain</dc:creator>
      <dc:date>2019-11-22T13:17:50Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion From Numeric to Words Format in Indian Currency</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Conversion-From-Numeric-to-Words-Format-in-Indian-Currency/m-p/606457#M17412</link>
      <description>&lt;P&gt;What would you like the format to return then?&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 14:09:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Conversion-From-Numeric-to-Words-Format-in-Indian-Currency/m-p/606457#M17412</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-11-22T14:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion From Numeric to Words Format in Indian Currency</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Conversion-From-Numeric-to-Words-Format-in-Indian-Currency/m-p/606685#M17426</link>
      <description>I want the output like this&lt;BR /&gt;IF X=1321462&lt;BR /&gt;OUTPUT=Thirteen lakh twenty-one thousand four hundred sixty two</description>
      <pubDate>Sat, 23 Nov 2019 16:43:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Conversion-From-Numeric-to-Words-Format-in-Indian-Currency/m-p/606685#M17426</guid>
      <dc:creator>aashish_jain</dc:creator>
      <dc:date>2019-11-23T16:43:04Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion From Numeric to Words Format in Indian Currency</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Conversion-From-Numeric-to-Words-Format-in-Indian-Currency/m-p/606781#M17436</link>
      <description>&lt;P&gt;Something like below could work. I haven't looked up what the next unit after lakh is so if your number can become that big then you would need to extend the function accordingly.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc fcmp outlib=work.functions.myfuncs;
   function lakh_words(in_num) $;
      length lakh_words $150;
      _lakh=abs(int(in_num/100000));
      if _lakh&amp;gt;0 then
        do;
          if abs(in_num) ne in_num then
            do;
              lakh_words='minus';
              in_num=abs(in_num);
            end;
          lakh_words=catx(' ',lakh_words, put(_lakh,words60.),'lakh'
                          ,put((in_num- _lakh*100000),words150.)
                         );
        end;
      else
        lakh_words=put(in_num,words150.);

      return(lakh_words); 
   endsub;
run;
options cmplib=(work.functions);

/* Create a format using the function created by the FCMP procedure. */
proc format; 
  value lakh_words(default=150) 
    other=[lakh_words()]
  ; 
run;


data test;
  input numvar;
  datalines;
462
1462
21462
321462
1321462
51321462
51321462.3
-51321462.3
;

proc print data=test;
  format numvar lakh_words. ; 
  var numvar / style(data)=[textalign= left];
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 493px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/34207iEEC690A0E3BE0E88/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Nov 2019 07:57:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Conversion-From-Numeric-to-Words-Format-in-Indian-Currency/m-p/606781#M17436</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-11-24T07:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion From Numeric to Words Format in Indian Currency</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Conversion-From-Numeric-to-Words-Format-in-Indian-Currency/m-p/606788#M17438</link>
      <description>&lt;P&gt;Thank You So much for the help.&lt;/P&gt;&lt;P&gt;The code worked like a charm.&lt;/P&gt;&lt;P&gt;The only Limitation I figured out that it didn't work for values in Crores, for that you already told to adjust the formulas.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks Again.&lt;/P&gt;</description>
      <pubDate>Sun, 24 Nov 2019 08:00:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Conversion-From-Numeric-to-Words-Format-in-Indian-Currency/m-p/606788#M17438</guid>
      <dc:creator>aashish_jain</dc:creator>
      <dc:date>2019-11-24T08:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion From Numeric to Words Format in Indian Currency</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Conversion-From-Numeric-to-Words-Format-in-Indian-Currency/m-p/606789#M17439</link>
      <description>While using PROC FORMAT. It didn't let me choose the same name of the format i.e lakh_words.&lt;BR /&gt;So I used lakh_wordsA.</description>
      <pubDate>Sun, 24 Nov 2019 08:02:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Conversion-From-Numeric-to-Words-Format-in-Indian-Currency/m-p/606789#M17439</guid>
      <dc:creator>aashish_jain</dc:creator>
      <dc:date>2019-11-24T08:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion From Numeric to Words Format in Indian Currency</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Conversion-From-Numeric-to-Words-Format-in-Indian-Currency/m-p/606792#M17441</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp;very nice!&lt;/P&gt;</description>
      <pubDate>Sun, 24 Nov 2019 08:55:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Conversion-From-Numeric-to-Words-Format-in-Indian-Currency/m-p/606792#M17441</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-11-24T08:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion From Numeric to Words Format in Indian Currency</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Conversion-From-Numeric-to-Words-Format-in-Indian-Currency/m-p/606796#M17442</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/272464"&gt;@aashish_jain&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I Googled that right then the units change by 10 power 2.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below a code version which also covers crore and arab. If you need even more units then the only thing you should need to do is amending the array statement.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc fcmp outlib=work.functions.myfuncs;
   function ind_num_terms(in_num) $;
      length ind_num_in_words $150;
      _in_num_abs=abs(in_num);

      _ind_num_part=int(_in_num_abs/100000);
      if _ind_num_part&amp;gt;0 then
        do;
          array ind_terms {3} $5 ('lakh','crore','arab');
          _units=ceil(length(strip(put(_ind_num_part,16.)))/2);
          _remainder=_ind_num_part;
          do _i=min(_units,dim(ind_terms)) to 1 by -1;
            ind_num_in_words=catx(' ',ind_num_in_words,put(int(_remainder/100**(_i-1)),words60.),ind_terms[_i]);
            _remainder=_remainder-int(_remainder/100**(_i-1))*(100**(_i-1));
          end;
          ind_num_in_words=catx(' ',ifc(_in_num_abs=in_num,' ','minus')
                                ,ind_num_in_words,put((_in_num_abs- _ind_num_part*100000),words150.)
                                );
        end;
      else
        ind_num_in_words=put(in_num,words150.);
      return(ind_num_in_words); 
   endsub;
run;
options cmplib=(work.functions);

/* Create a format using the function created by the FCMP procedure. */
proc format; 
  value ind_num_terms(default=150) 
    other=[ind_num_terms()]
  ; 
run;


data test;
  input numvar;
  datalines;
1
21
321
4321
54321
654321
7654321
87654321
987654321
1987654321
21987654321
-21462
-51321462
-51321462.3
;

proc print data=test;
  format numvar ind_num_terms.;
  var numvar / style(data)=[textalign= left];
run;
&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Nov 2019 10:04:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Conversion-From-Numeric-to-Words-Format-in-Indian-Currency/m-p/606796#M17442</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-11-24T10:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion From Numeric to Words Format in Indian Currency</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Conversion-From-Numeric-to-Words-Format-in-Indian-Currency/m-p/606816#M17447</link>
      <description>Thank you again for taking the time to figure out and making the code dynamic.&lt;BR /&gt;</description>
      <pubDate>Sun, 24 Nov 2019 14:46:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Conversion-From-Numeric-to-Words-Format-in-Indian-Currency/m-p/606816#M17447</guid>
      <dc:creator>aashish_jain</dc:creator>
      <dc:date>2019-11-24T14:46:54Z</dc:date>
    </item>
  </channel>
</rss>

