<?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: How do I save subsets to separate folders with script in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-do-I-save-subsets-to-separate-folders-with-script/m-p/574418#M78320</link>
    <description>&lt;P&gt;In addition to &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;'s extensive answer, you might like to take a look at the function &lt;STRONG&gt;ConvertFilePath&lt;/STRONG&gt;.&amp;nbsp; Although, as the name suggests, it can be used to convert file paths (e.g. from Windows to MacOS formats, or from relative to full paths), I like it because it allows me to manipulate file paths whilst keeping file name and directory information separate, without having to worry about string concatenation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;e.g.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;projectHomeFolder = FilePathDefinitions:getProjectHome();
path = convertFilePath("Master_Table.jmp",base(projectHomeFolder));&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 29 Nov 2022 08:11:26 GMT</pubDate>
    <dc:creator>David_Burnham</dc:creator>
    <dc:date>2022-11-29T08:11:26Z</dc:date>
    <item>
      <title>How do I save subsets to separate folders with script</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-save-subsets-to-separate-folders-with-script/m-p/574354#M78315</link>
      <description>&lt;P&gt;I have created a script that will import and excel file and perform an analysis that will produce 3 subsets. Each subset needs to be a different folder but I want the subsets to have the same name as the excel file that was imported to create the subset. How would I do this or at least name each subset a specific name and save them to different folders.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 16:03:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-save-subsets-to-separate-folders-with-script/m-p/574354#M78315</guid>
      <dc:creator>Terelaloca</dc:creator>
      <dc:date>2023-06-09T16:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do I save subsets to separate folders with script</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-save-subsets-to-separate-folders-with-script/m-p/574388#M78317</link>
      <description>&lt;P&gt;Here is an example of one way to do this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Open a file and create 2 subsets and then save all 3 files to 
// different folders, keeping the files open in the JMP session,
// and with their original name, but naming each subset in their
// folders where they are saved

Names Default To Here( 1 );

// open the Big Class data table.
dt = Open( "$SAMPLE_DATA/big class.jmp" );

// Create subset one with all Males, letting JMP provide the new data table name
dt &amp;lt;&amp;lt; select where( :sex == "M" );
dtA = dt &amp;lt;&amp;lt; subset( selected columns( 0 ), selected rows( 1 ) );

// Create subset two with all Females, giving JMP the name of the new table
dt &amp;lt;&amp;lt; select where( :sex == "F" );
dtB = dt &amp;lt;&amp;lt; subset( selected columns( 0 ), selected rows( 1 ), Output Table( "All Females" ) );

// The Save() function automatically changes the name of the data table being saved
// to the name being specified in the file name specified in the Path of the Save() 
// function.  Therefore to keep the original table the original name, it has to be 
// renamed back to the original name.
holdName = dt &amp;lt;&amp;lt; get name;
dt &amp;lt;&amp;lt; save( "C:/folderA/MyName.jmp" );
dt &amp;lt;&amp;lt; set name( holdName );

// Repeat the save for the first subset
holdName = dtA &amp;lt;&amp;lt; get name;
dtA &amp;lt;&amp;lt; save( "C:/folderB/MyName.jmp" );
dtA &amp;lt;&amp;lt; set name( holdName );

// Repeat for the second subset.  The name of this subset has been specifically provided
// so the handling of this can be a little different
Data Table( "All Females" ) &amp;lt;&amp;lt; save( "C:/folderC/MyName.jmp" );
Data Table( "MyName" ) &amp;lt;&amp;lt; set name( "All Females" );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Nov 2022 06:36:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-save-subsets-to-separate-folders-with-script/m-p/574388#M78317</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-11-29T06:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do I save subsets to separate folders with script</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-save-subsets-to-separate-folders-with-script/m-p/574418#M78320</link>
      <description>&lt;P&gt;In addition to &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;'s extensive answer, you might like to take a look at the function &lt;STRONG&gt;ConvertFilePath&lt;/STRONG&gt;.&amp;nbsp; Although, as the name suggests, it can be used to convert file paths (e.g. from Windows to MacOS formats, or from relative to full paths), I like it because it allows me to manipulate file paths whilst keeping file name and directory information separate, without having to worry about string concatenation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;e.g.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;projectHomeFolder = FilePathDefinitions:getProjectHome();
path = convertFilePath("Master_Table.jmp",base(projectHomeFolder));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Nov 2022 08:11:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-save-subsets-to-separate-folders-with-script/m-p/574418#M78320</guid>
      <dc:creator>David_Burnham</dc:creator>
      <dc:date>2022-11-29T08:11:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do I save subsets to separate folders with script</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-save-subsets-to-separate-folders-with-script/m-p/576551#M78444</link>
      <description>&lt;P&gt;Thank you so much! This was incredibly helpful&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2022 15:29:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-save-subsets-to-separate-folders-with-script/m-p/576551#M78444</guid>
      <dc:creator>Terelaloca</dc:creator>
      <dc:date>2022-12-02T15:29:41Z</dc:date>
    </item>
  </channel>
</rss>

