<?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: Opened CSV file - how to get path in JSL in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Opened-CSV-file-how-to-get-path-in-JSL/m-p/224523#M267821</link>
    <description>If you are generating the JMP code then why not just write the path into the code that you generate?</description>
    <pubDate>Tue, 08 Sep 2015 21:47:54 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2015-09-08T21:47:54Z</dc:date>
    <item>
      <title>Opened CSV file - how to get path in JSL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Opened-CSV-file-how-to-get-path-in-JSL/m-p/224520#M267820</link>
      <description>&lt;P&gt;At work, I've written some Python scripts to pull a bunch of data from our database, save it as a CSV, open it in JMP, and run a JSL script on it to create some graphs and other junk. The problem I'm running into is that I cannot find a way to get the full path to the CSV file&amp;nbsp;&lt;EM&gt;within&lt;/EM&gt; the JSL script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Python script creates the directory, moves the CSV into it, and then opens the CSV in JMP and immediately runs the JSL script on it. In th Python script, this looks something like:&lt;/P&gt;&lt;P&gt;os.chdir(sJMPLoc) // move to the JMP install dir&lt;BR /&gt;subprocess.Popen(sCmdOpen) // execute the command to open the CSV file in JMP&lt;BR /&gt;subprocess.Popen(sCmdScript) // execute the command to run the JSL script&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the JSL:&lt;/P&gt;&lt;P&gt;dt = Current Data Table();&lt;/P&gt;&lt;P&gt;dt &amp;lt;&amp;lt; Save();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This didn't appear to&amp;nbsp;work, so I started digging to see where it thought the file was stored and added this to my script:&lt;BR /&gt;dir = dt &amp;lt;&amp;lt; getpath;&lt;BR /&gt;show(dir);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Results of that:&lt;/P&gt;&lt;P&gt;dir = "POWER_CORRELATIONS_YESTERDAY_09_08_15__15_36_57.jmp";&lt;/P&gt;&lt;P&gt;Turns out JMP is converting the .CSV into a .JMP file and storing it in some temp directory, or at least the dt &amp;lt;&amp;lt; getpath function isn't aware of the original path.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I get the path to the CSV&amp;nbsp;&lt;EM&gt;where the CSV was when it was opened&lt;/EM&gt;?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Chip&lt;/P&gt;</description>
      <pubDate>Tue, 08 Sep 2015 21:11:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Opened-CSV-file-how-to-get-path-in-JSL/m-p/224520#M267820</guid>
      <dc:creator>wooden</dc:creator>
      <dc:date>2015-09-08T21:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: Opened CSV file - how to get path in JSL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Opened-CSV-file-how-to-get-path-in-JSL/m-p/224523#M267821</link>
      <description>If you are generating the JMP code then why not just write the path into the code that you generate?</description>
      <pubDate>Tue, 08 Sep 2015 21:47:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Opened-CSV-file-how-to-get-path-in-JSL/m-p/224523#M267821</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-09-08T21:47:54Z</dc:date>
    </item>
    <item>
      <title>Re: Opened CSV file - how to get path in JSL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Opened-CSV-file-how-to-get-path-in-JSL/m-p/224524#M267822</link>
      <description>&lt;P&gt;Every time the Python script runs, it creates a new directory for the data and all reports for it. If I could get our database tools to save the file as a JMP file, this would all be easy as JMP retains the path to JMP files:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*:&lt;BR /&gt;//:*/&lt;BR /&gt;dt = Current Data Table();&lt;BR /&gt;show(dt &amp;lt;&amp;lt; getpath);&lt;BR /&gt;/*:&lt;/P&gt;&lt;P&gt;dt &amp;lt;&amp;lt; getpath = "C:\Users\cpwood\Documents\correlationData\power_54W_ww32p1_working.jmp";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The same cannot be said about CSVs:&lt;/P&gt;&lt;P&gt;/*:&lt;BR /&gt;//:*/&lt;BR /&gt;dt = Current Data Table();&lt;BR /&gt;show(dt &amp;lt;&amp;lt; getpath);&lt;BR /&gt;/*:&lt;/P&gt;&lt;P&gt;dt &amp;lt;&amp;lt; getpath = "POWER_CORRELATIONS_YESTERDAY_09_04_15__15_36_57.jmp";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The POWER_CORRELATIONS_YESTERDAY... file was a CSV when opened, but JMP appears to immediately convert it to a JMP file (reasonably so) and ditch the path for some odd reason.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Sep 2015 21:59:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Opened-CSV-file-how-to-get-path-in-JSL/m-p/224524#M267822</guid>
      <dc:creator>wooden</dc:creator>
      <dc:date>2015-09-08T21:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: Opened CSV file - how to get path in JSL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Opened-CSV-file-how-to-get-path-in-JSL/m-p/938141#M368539</link>
      <description>&lt;P&gt;I am running into the same issue. The reason I did not write the path into the code is because I am trying to automate the process so that the script find the path and then saves a JMP plot in the folder that had the original csv file. I am also having the issue that JMP loses the path that I selected and instead selects the path that points to the script file folder, not the csv file folder...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 22:15:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Opened-CSV-file-how-to-get-path-in-JSL/m-p/938141#M368539</guid>
      <dc:creator>Jens_Riege</dc:creator>
      <dc:date>2024-08-02T22:15:19Z</dc:date>
    </item>
  </channel>
</rss>

