<?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: Converting txt file into sas data set in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-sas-data-set/m-p/456676#M115695</link>
    <description>&lt;P&gt;Why create the text file at all?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    infile "ps aux | awk '{print $1,$2,$3,$6,$11}'" pipe firstobs=2 truncover ;
    input user :$40. pid cpu rss command $500.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 23 Apr 2018 20:05:39 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2018-04-23T20:05:39Z</dc:date>
    <item>
      <title>Converting txt file into sas data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-sas-data-set/m-p/456632#M115675</link>
      <description>&lt;P&gt;Dear All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to execute a linux command and from de result create a data set:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro psawk;&lt;BR /&gt;%sysexec %str(ps aux | awk '{print $1,$2,$3,$6,$11}' &amp;gt;/SASData/test11.txt);&lt;BR /&gt;%mend psawk;&lt;BR /&gt;%psawk;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;from this I get a file with the following structure&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sas.png" style="width: 254px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/20063iE9B9B1F4FD790551/image-size/large?v=v2&amp;amp;px=999" role="button" title="sas.png" alt="sas.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Abraham&lt;/P&gt;</description>
      <pubDate>Mon, 23 Apr 2018 18:29:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-sas-data-set/m-p/456632#M115675</guid>
      <dc:creator>kaoru013</dc:creator>
      <dc:date>2018-04-23T18:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: Converting txt file into sas data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-sas-data-set/m-p/456647#M115684</link>
      <description>Hi:&lt;BR /&gt;  In order to turn this file into a SAS data set, you will have to import it into SAS. You can do this a variety of ways -- either PROC IMPORT or a DATA step program. I would probably use a DATA step program.&lt;BR /&gt;&lt;BR /&gt;What code did you try? What do you want the variables to be named. Note that SAS Variable names should start with a letter or underscore, so %CPU is not a SAS variable name.&lt;BR /&gt;&lt;BR /&gt;cynthia&lt;BR /&gt;&lt;BR /&gt;cynthia</description>
      <pubDate>Mon, 23 Apr 2018 18:58:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-sas-data-set/m-p/456647#M115684</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2018-04-23T18:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: Converting txt file into sas data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-sas-data-set/m-p/456649#M115686</link>
      <description>&lt;P&gt;Assign filename to the file created by the command and read it into sas:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename result '/SASData/test11.txt';  

data want;
    infile result truncover firstobs=2;
    input user $ @; 
    if user = "USER" then do; input; return; end; /* skip 1st line */
    input  pid cpu rss command $;
run;
    &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Apr 2018 19:00:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-sas-data-set/m-p/456649#M115686</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-04-23T19:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: Converting txt file into sas data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-sas-data-set/m-p/456655#M115688</link>
      <description>&lt;P&gt;Thanks for your answer, it &lt;SPAN class=""&gt;it works but I have a problem in the command column just put a fragment and not the complete information, this field can have up to 400 characters.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;Regards&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Apr 2018 19:20:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-sas-data-set/m-p/456655#M115688</guid>
      <dc:creator>kaoru013</dc:creator>
      <dc:date>2018-04-23T19:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: Converting txt file into sas data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-sas-data-set/m-p/456667#M115692</link>
      <description>Hi:&lt;BR /&gt;  Then you need to have a Length statement:&lt;BR /&gt;LENGTH command $400;&lt;BR /&gt;&lt;BR /&gt;Cynthia</description>
      <pubDate>Mon, 23 Apr 2018 19:48:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-sas-data-set/m-p/456667#M115692</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2018-04-23T19:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: Converting txt file into sas data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-sas-data-set/m-p/456668#M115693</link>
      <description>&lt;P&gt;The default length is 8.&lt;/P&gt;
&lt;P&gt;Change the $ after &lt;STRONG&gt;command&amp;nbsp;&lt;/STRONG&gt;to $400.&amp;nbsp; (include the dot).&lt;/P&gt;</description>
      <pubDate>Mon, 23 Apr 2018 19:50:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-sas-data-set/m-p/456668#M115693</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-04-23T19:50:56Z</dc:date>
    </item>
    <item>
      <title>Re: Converting txt file into sas data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-sas-data-set/m-p/456673#M115694</link>
      <description>&lt;P&gt;thanks for all your help&lt;/P&gt;</description>
      <pubDate>Mon, 23 Apr 2018 19:59:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-sas-data-set/m-p/456673#M115694</guid>
      <dc:creator>kaoru013</dc:creator>
      <dc:date>2018-04-23T19:59:49Z</dc:date>
    </item>
    <item>
      <title>Re: Converting txt file into sas data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-sas-data-set/m-p/456676#M115695</link>
      <description>&lt;P&gt;Why create the text file at all?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    infile "ps aux | awk '{print $1,$2,$3,$6,$11}'" pipe firstobs=2 truncover ;
    input user :$40. pid cpu rss command $500.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Apr 2018 20:05:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-txt-file-into-sas-data-set/m-p/456676#M115695</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-04-23T20:05:39Z</dc:date>
    </item>
  </channel>
</rss>

