<?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 How to turn the output of an x command into a variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-turn-the-output-of-an-x-command-into-a-variable/m-p/866740#M342310</link>
    <description>&lt;P&gt;I'm looking to&amp;nbsp; get the output of unix command&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;%let myfile =&amp;nbsp; x 'ls -tr /sas/data/mydata | tail -1';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;to be added into the sas program as a variable&amp;nbsp; &amp;amp;myfile to use in the program and I can get awa from hardcoded filenames.&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;</description>
    <pubDate>Tue, 28 Mar 2023 14:55:37 GMT</pubDate>
    <dc:creator>fgasdg</dc:creator>
    <dc:date>2023-03-28T14:55:37Z</dc:date>
    <item>
      <title>How to turn the output of an x command into a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-turn-the-output-of-an-x-command-into-a-variable/m-p/866740#M342310</link>
      <description>&lt;P&gt;I'm looking to&amp;nbsp; get the output of unix command&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;%let myfile =&amp;nbsp; x 'ls -tr /sas/data/mydata | tail -1';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;to be added into the sas program as a variable&amp;nbsp; &amp;amp;myfile to use in the program and I can get awa from hardcoded filenames.&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 14:55:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-turn-the-output-of-an-x-command-into-a-variable/m-p/866740#M342310</guid>
      <dc:creator>fgasdg</dc:creator>
      <dc:date>2023-03-28T14:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to turn the output of an x command into a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-turn-the-output-of-an-x-command-into-a-variable/m-p/866759#M342319</link>
      <description>&lt;P&gt;This macro, not mine, will generate the directory listing of a folder into a data set and can recursively search the subfolders. Set the depth to control it not searching.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/sasutils/macros/blob/master/dirtree.sas" target="_blank"&gt;https://github.com/sasutils/macros/blob/master/dirtree.sas&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 16:24:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-turn-the-output-of-an-x-command-into-a-variable/m-p/866759#M342319</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-03-28T16:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to turn the output of an x command into a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-turn-the-output-of-an-x-command-into-a-variable/m-p/866950#M342394</link>
      <description>&lt;P&gt;You probably want to use a PIPE device, e.g.:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename ls pipe 'ls -tr /sas/data/mydata | tail -1';
data want;
  infile ls;
  input &amp;lt;whatever you want from the input&amp;gt;;&lt;BR /&gt;  call symputx('myfile',&amp;lt;the variable you read&amp;gt;);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 12:19:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-turn-the-output-of-an-x-command-into-a-variable/m-p/866950#M342394</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2023-03-29T12:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to turn the output of an x command into a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-turn-the-output-of-an-x-command-into-a-variable/m-p/866998#M342408</link>
      <description>&lt;P&gt;Exactly what I needed. Works perfectly! thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 14:05:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-turn-the-output-of-an-x-command-into-a-variable/m-p/866998#M342408</guid>
      <dc:creator>fgasdg</dc:creator>
      <dc:date>2023-03-29T14:05:53Z</dc:date>
    </item>
  </channel>
</rss>

