<?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 Exporting formatted values to R in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Exporting-formatted-values-to-R/m-p/570267#M4732</link>
    <description>&lt;P&gt;Hi everyone, I would like to send a SAS dataset to R with the formatted values. When I use ExportDataSetToR the dataset is sent with the unformatted values. Any help on how I can retain formatted values? Here is a toy example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   input x $;
datalines;
A
B
;

proc format;
   value $x 'A'='One'
	        'B'='Two';
run;

data have; set have; format x $x.; run;

proc iml;
   call ExportDataSetToR("have","want");
   submit / R;
      want&lt;BR /&gt;&lt;BR /&gt;   endsubmit;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In this example the values 'A' and 'B' show in R instead of 'One' and 'Two'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 01 Jul 2019 14:19:06 GMT</pubDate>
    <dc:creator>spirto</dc:creator>
    <dc:date>2019-07-01T14:19:06Z</dc:date>
    <item>
      <title>Exporting formatted values to R</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Exporting-formatted-values-to-R/m-p/570267#M4732</link>
      <description>&lt;P&gt;Hi everyone, I would like to send a SAS dataset to R with the formatted values. When I use ExportDataSetToR the dataset is sent with the unformatted values. Any help on how I can retain formatted values? Here is a toy example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   input x $;
datalines;
A
B
;

proc format;
   value $x 'A'='One'
	        'B'='Two';
run;

data have; set have; format x $x.; run;

proc iml;
   call ExportDataSetToR("have","want");
   submit / R;
      want&lt;BR /&gt;&lt;BR /&gt;   endsubmit;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In this example the values 'A' and 'B' show in R instead of 'One' and 'Two'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2019 14:19:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Exporting-formatted-values-to-R/m-p/570267#M4732</guid>
      <dc:creator>spirto</dc:creator>
      <dc:date>2019-07-01T14:19:06Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting formatted values to R</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Exporting-formatted-values-to-R/m-p/570270#M4733</link>
      <description>&lt;P&gt;R doesn't have formats, which is why the formats get stripped out (except for data, time, and datetime). If you want to send in the formatted data, you can use the PUT function to create the formatted values in a separate variable:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
   value $x 'A'='One'
	        'B'='Two';
run;

data have;
input x $;
format x $x.;
datalines;
A
B
;

data want; 
  set have(rename=(x=xRaw)); /* rename the raw data */
  length x $3;               /* =max length of formmatted values */
  x = put(xRaw, $x.);        /* new var w/ formatted values */
run;

proc iml;
call ExportDataSetToR("want","wantInR");
submit / R;
   wantInR
endsubmit;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 01 Jul 2019 14:38:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Exporting-formatted-values-to-R/m-p/570270#M4733</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-07-01T14:38:47Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting formatted values to R</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Exporting-formatted-values-to-R/m-p/570277#M4734</link>
      <description>&lt;P&gt;As always, thank you Rick&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2019 14:54:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Exporting-formatted-values-to-R/m-p/570277#M4734</guid>
      <dc:creator>spirto</dc:creator>
      <dc:date>2019-07-01T14:54:42Z</dc:date>
    </item>
  </channel>
</rss>

