<?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: Creating multiple datasets in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Creating-multiple-datasets/m-p/230447#M2401</link>
    <description>looks like I made this WAY more complicated than needed - your solution works prefect - thanks!!</description>
    <pubDate>Sun, 18 Oct 2015 00:06:21 GMT</pubDate>
    <dc:creator>Dave25</dc:creator>
    <dc:date>2015-10-18T00:06:21Z</dc:date>
    <item>
      <title>Creating multiple datasets</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Creating-multiple-datasets/m-p/230423#M2399</link>
      <description>&lt;P&gt;New to IML (just got it, for accessing R). &amp;nbsp;I'd like to run multiple datasets through R, and create multiple datasets from R run.&lt;/P&gt;
&lt;P&gt;Using some of the really good posts by Rick Wicklin, I think I'm pretty close, but can't figure out the last step (creating separate datasets for each loop through the do loop). &amp;nbsp;Below is the code I'm using (i dummied a couple datasets for demo purposes)&lt;/P&gt;
&lt;P&gt;-- any suggestions would be greatly appreaciated.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Dave&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/*Demo Datasetss*/&lt;BR /&gt;data in1; retain id g_yr1 g_yr2 ss_yr1 ss_yr2;&lt;BR /&gt;do id = 1 to 100;&lt;BR /&gt;g_yr1 = 3; g_yr2 = 4; ss_yr1 = rannor(0); ss_yr2 = rannor(0) + .5; output;&lt;BR /&gt;end;&lt;BR /&gt; run;&lt;BR /&gt;data in2; retain id g_yr1 g_yr2 ss_yr1 ss_yr2;&lt;BR /&gt;do id = 1 to 100;&lt;BR /&gt;g_yr1 = 3; g_yr2 = 4; ss_yr1 = rannor(0); ss_yr2 = rannor(0) + .5; output;&lt;BR /&gt;end;&lt;BR /&gt; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc IML;&lt;BR /&gt; dsnames = "in1":"in2";&lt;BR /&gt;outnames = "out1":"out2" ;&lt;BR /&gt;outnames = {out1 out2};&lt;BR /&gt;do i = 1 to ncol(dsNames);&lt;BR /&gt; use (dsNames[i]);&lt;BR /&gt; read all into X;&lt;BR /&gt; create dt from x;&lt;BR /&gt; append from x; &lt;BR /&gt; close dt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;run ExportDataSetToR("dt", "dataframe" );&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;submit /R;&lt;BR /&gt; library("SGPdata")&lt;BR /&gt; library("SGP")&lt;BR /&gt; library("foreign")&lt;BR /&gt; sgpData34&amp;lt;- dataframe &lt;BR /&gt; g5_sgp34 &amp;lt;- studentGrowthPercentiles(panel.data = sgpData34, sgp.labels=list(my.year =2014, my.subject="MATH"), &lt;BR /&gt; num.prior = 1, grade.progression =3:4)&lt;BR /&gt; exp &amp;lt;- g5_sgp34$SGPercentiles$MATH.2014 &lt;BR /&gt; endsubmit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;call ImportDataSetFromR("R_exp", "exp");&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;use R_exp;&lt;BR /&gt; read all into x1;&lt;BR /&gt; create outx from x1;&lt;BR /&gt; append from x1; &lt;BR /&gt; close outx;&lt;BR /&gt; close R_exp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; /* here is where I'd like to "create" dataset&amp;nbsp;out1 and out2 (based on the value of i), from the dataset R_exp*??*//&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;close (dsNames[i]);&lt;BR /&gt;end;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Oct 2015 18:32:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Creating-multiple-datasets/m-p/230423#M2399</guid>
      <dc:creator>Dave25</dc:creator>
      <dc:date>2015-10-17T18:32:09Z</dc:date>
    </item>
    <item>
      <title>Re: Creating multiple datasets</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Creating-multiple-datasets/m-p/230445#M2400</link>
      <description>&lt;P&gt;Since your ultimate goal seems to be to transfer data between SAS data sets and R data frames, I suggest you&lt;A href="http://support.sas.com/documentation/cdl/en/imlug/68150/HTML/default/viewer.htm#imlug_r_sect005.htm" target="_self"&gt; transfer the data directl&lt;/A&gt;y&amp;nbsp;by&amp;nbsp;using the ExportDataSetToR &amp;nbsp;and &amp;nbsp;ImportDataSetFromR subroutines.&amp;nbsp; It looks like you aren't actually using the SAS/IML matrices for anything, so why create them?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I believe you can just say&lt;/P&gt;
&lt;P&gt;call ExportDataSetToR(dsnames[i], "dataframe");&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;then after R has run call&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;call ImportDataSetFromR(outnames[i], "exp");&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Oct 2015 23:44:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Creating-multiple-datasets/m-p/230445#M2400</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2015-10-17T23:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: Creating multiple datasets</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Creating-multiple-datasets/m-p/230447#M2401</link>
      <description>looks like I made this WAY more complicated than needed - your solution works prefect - thanks!!</description>
      <pubDate>Sun, 18 Oct 2015 00:06:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Creating-multiple-datasets/m-p/230447#M2401</guid>
      <dc:creator>Dave25</dc:creator>
      <dc:date>2015-10-18T00:06:21Z</dc:date>
    </item>
  </channel>
</rss>

