<?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: Numeric variable to chracter with a space in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-to-chracter-with-a-space/m-p/797372#M287476</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
picture fmt
low-high='000 000 000€';
run;

data have;
input x;
want=put(x,fmt. -l);
cards;
1500
12345678
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 19 Feb 2022 10:53:35 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2022-02-19T10:53:35Z</dc:date>
    <item>
      <title>Numeric variable to chracter with a space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-to-chracter-with-a-space/m-p/797224#M255900</link>
      <description>&lt;DIV dir="ltr"&gt;If I have a numeric variable with the value 1500 and want to turn it into a character variable, with the space in this way 1 500 €. Can you please tell me how I can edit my expression to resolve this?&lt;/DIV&gt;
&lt;DIV dir="ltr"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV dir="ltr"&gt;New_value=compress(put(Value), euro10.2));&lt;/DIV&gt;
&lt;DIV dir="ltr"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV dir="ltr"&gt;I mean, when I use the compress function, there is no space any more...&lt;/DIV&gt;
&lt;DIV dir="ltr"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV dir="ltr"&gt;Thank you for your help !&lt;/DIV&gt;</description>
      <pubDate>Fri, 18 Feb 2022 13:52:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-to-chracter-with-a-space/m-p/797224#M255900</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2022-02-18T13:52:08Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric variable to chracter with a space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-to-chracter-with-a-space/m-p/797227#M255901</link>
      <description>&lt;P&gt;Why do a COMPRESS if you don't want the result of COMPRESS?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As far as I know, there is no built in money format that uses a space instead of a comma or a period. Why not use a function that replaces the comma with a space? The &lt;A href="https://documentation.sas.com/doc/en/pgmmvacdc/9.4/lefunctionsref/p05ww22zp7lcg3n1bjk7v93tscyo.htm" target="_self"&gt;TRANSLATE function&lt;/A&gt; will do that for you.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 14:22:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-to-chracter-with-a-space/m-p/797227#M255901</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-02-18T14:22:19Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric variable to chracter with a space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-to-chracter-with-a-space/m-p/797260#M255915</link>
      <description>&lt;P&gt;Thank you, but unfortunately it doesn't work :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data test;&lt;BR /&gt;set ACCORD;&lt;BR /&gt;test=compress(put(Montant_min_de_vers_init,euro10.));&lt;BR /&gt;test1=compress(substr(test,2))||"€";&lt;/P&gt;
&lt;P&gt;test2=translate(test1,',',' ');&lt;BR /&gt;keep test test1 test2;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MarieT_0-1645200255629.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/68659i321EC78DC6479481/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MarieT_0-1645200255629.png" alt="MarieT_0-1645200255629.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 16:04:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-to-chracter-with-a-space/m-p/797260#M255915</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2022-02-18T16:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric variable to chracter with a space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-to-chracter-with-a-space/m-p/797270#M255922</link>
      <description>&lt;P&gt;You have typed the arguments to the TRANSLATE function incorrectly. If you want to replace a comma with a space, you would use this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;test2=translate(test1,' ',',');&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Feb 2022 16:37:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-to-chracter-with-a-space/m-p/797270#M255922</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-02-18T16:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric variable to chracter with a space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-to-chracter-with-a-space/m-p/797277#M255927</link>
      <description>&lt;P&gt;Not sure why you have the COMPRESS() function at all.&amp;nbsp; You have the arguments to TRANSLATE() backwards.&lt;/P&gt;
&lt;PRE&gt;43    data test;
44      Montant_min_de_vers_init=1500;
45      test=put(Montant_min_de_vers_init,euro10.-L);
46      test1=cats(substr(test,2),char(test,1));
47      test2=translate(test1,' ',',');
48      put (test:) (=:$quote. /);
49    run;

test="€1,500"
test1="1,500€"
test2="1 500€"
&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Feb 2022 16:51:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-to-chracter-with-a-space/m-p/797277#M255927</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-02-18T16:51:49Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric variable to chracter with a space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-to-chracter-with-a-space/m-p/797280#M255929</link>
      <description>&lt;P&gt;Or just use the appropriate LOCALE setting then you can use the NLMNY format.&lt;/P&gt;
&lt;PRE&gt;92    %let locale=%sysfunc(getoption(locale));
93    %put &amp;amp;=locale;
LOCALE=EN_US
94    options locale='fi_FI';
95    data test;
96      Montant_min_de_vers_init=1500;
97      test=left(put(Montant_min_de_vers_init,euro10.));
98      test1=substr(cats(test,char(test,1)),2);
99      test2=translate(test1,' ',',');
100     test3=put(1500,nlmny10.);
101     put (test:) (=:$quote. /);
102   run;

test="€1,500"
test1="1,500€"
test2="1 500€"
test3="   1&amp;nbsp;500 €"
NOTE: The data set WORK.TEST has 1 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


103   options locale="&amp;amp;locale";
&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Feb 2022 17:03:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-to-chracter-with-a-space/m-p/797280#M255929</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-02-18T17:03:30Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric variable to chracter with a space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-to-chracter-with-a-space/m-p/797295#M255938</link>
      <description>Thank you, Tom, it works !</description>
      <pubDate>Fri, 18 Feb 2022 18:08:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-to-chracter-with-a-space/m-p/797295#M255938</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2022-02-18T18:08:07Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric variable to chracter with a space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-to-chracter-with-a-space/m-p/797372#M287476</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
picture fmt
low-high='000 000 000€';
run;

data have;
input x;
want=put(x,fmt. -l);
cards;
1500
12345678
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 19 Feb 2022 10:53:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Numeric-variable-to-chracter-with-a-space/m-p/797372#M287476</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-02-19T10:53:35Z</dc:date>
    </item>
  </channel>
</rss>

