<?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: Import a Tab-Delimited file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Import-a-Tab-Delimited-file/m-p/708202#M217587</link>
    <description>&lt;P&gt;Looks like your file has spaces between the values and not tabs.&lt;/P&gt;
&lt;P&gt;There is no need to use PROC IMPORT to read a text file, even if you have a delimited files.&amp;nbsp; Just write your own data step.&amp;nbsp; Especially for only three variables.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class ;
   infile '/folders/myfolders/cert/class.txt' truncover firstobs=2;
   input name :$10. gender :$6. age ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 25 Dec 2020 19:22:04 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2020-12-25T19:22:04Z</dc:date>
    <item>
      <title>Import a Tab-Delimited file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-a-Tab-Delimited-file/m-p/708201#M217586</link>
      <description>&lt;PRE&gt;options validvarname=v7;&lt;BR /&gt;proc import datafile='/folders/myfolders/cert/class.txt'
     dbms=tab
     out=class
     replace;
     delimiter='09'x;&lt;BR /&gt;     guessingrows=20;
run;
proc print data=class;
run;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;When I import tab-delimited file &lt;U&gt;&lt;EM&gt;3 variable&lt;/EM&gt;&amp;nbsp;, 19 obsevation&lt;/U&gt; to sas, only &lt;EM&gt;&lt;U&gt;1 variable, 19 observation&lt;/U&gt;&lt;/EM&gt; is imported. How can I correctly import 3 variable to sas? Thanks!&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;This is the log message and results :&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt; 88          ***********************************************************************/
 89             data WORK.CLASS    ;
 90             %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
 91             infile '/folders/myfolders/cert/class.txt' delimiter='09'x MISSOVER DSD lrecl=32767 firstobs=2 ;
 92                informat Name_____Gender___Age $20. ;
 93                format Name_____Gender___Age $20. ;
 94             input
 95                         Name_____Gender___Age  $
 96             ;
 97             if _ERROR_ then call symputx('_EFIERR_',1);  /* set ERROR detection macro variable */
 98             run;
 
 NOTE: The infile '/folders/myfolders/cert/class.txt' is:
       Filename=/folders/myfolders/cert/class.txt,
       Owner Name=root,Group Name=vboxsf,
       Access Permission=-rwxrwx---,
       Last Modified=21Dec2020:22:11:58,
       File Size (bytes)=1620
 
 NOTE: 19 records were read from the infile '/folders/myfolders/cert/class.txt'.
       The minimum record length was 80.
       The maximum record length was 80.
 NOTE: The data set WORK.CLASS has 19 observations and 1 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.01 seconds
       cpu time            0.00 seconds
       
 
 19 rows created in WORK.CLASS from /folders/myfolders/cert/class.txt.
   
   
   
 NOTE: WORK.CLASS data set was successfully created.
 NOTE: The data set WORK.CLASS has 19 observations and 1 variables.
 NOTE: PROCEDURE IMPORT used (Total process time):
       real time           0.10 seconds
       cpu time            0.07 seconds
       
 
 99         proc print data=class;
 100        run;
 
 NOTE: There were 19 observations read from the data set WORK.CLASS.
 NOTE: PROCEDURE PRINT used (Total process time):
       real time           0.06 seconds
       cpu time            0.06 seconds
       
 
 101        
 102        OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 114        &lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;output: Here should be 3 variables, but only output&amp;nbsp; one single variable:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;Obs	Name_____Gender___Age&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;however, 19 obs is printed.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;12345678910111213141516171819&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Joyce F 11&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Thomas M 11&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Jane F 12&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Louise F 12&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;James M 12&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;John M 12&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Robert M 12&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Alice F 13&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Barbara F 13&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Jeffery M 13&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Carol F 14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Judy F 14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Alfred M 14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Henry M 14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Jenet F 15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Mary F 15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Ronald M 15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;William M 15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Philip M 16&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Fri, 25 Dec 2020 19:00:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-a-Tab-Delimited-file/m-p/708201#M217586</guid>
      <dc:creator>alexx1</dc:creator>
      <dc:date>2020-12-25T19:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: Import a Tab-Delimited file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-a-Tab-Delimited-file/m-p/708202#M217587</link>
      <description>&lt;P&gt;Looks like your file has spaces between the values and not tabs.&lt;/P&gt;
&lt;P&gt;There is no need to use PROC IMPORT to read a text file, even if you have a delimited files.&amp;nbsp; Just write your own data step.&amp;nbsp; Especially for only three variables.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class ;
   infile '/folders/myfolders/cert/class.txt' truncover firstobs=2;
   input name :$10. gender :$6. age ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 25 Dec 2020 19:22:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-a-Tab-Delimited-file/m-p/708202#M217587</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-12-25T19:22:04Z</dc:date>
    </item>
    <item>
      <title>Re: Import a Tab-Delimited file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-a-Tab-Delimited-file/m-p/708598#M217789</link>
      <description>&lt;P&gt;Look very closely at this stuff&lt;/P&gt;
&lt;PRE&gt;     informat Name_____Gender___Age $20. ;
 93                format Name_____Gender___Age $20. ;
 94             input
 95                         Name_____Gender___Age  $&lt;/PRE&gt;
&lt;P&gt;The string Name_____Gender___Age has NO spaces. So is ONE identifier or only one value was read.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you indicate variables in an input statement there must be at least one space between the names of variables.&lt;/P&gt;
&lt;P&gt;Same for FORMAT, Informat, drop, keep and other places where multiple variables are used.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Dec 2020 17:14:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-a-Tab-Delimited-file/m-p/708598#M217789</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-12-29T17:14:38Z</dc:date>
    </item>
  </channel>
</rss>

