<?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: proc import got unwanted variable when converting a tab-delimited file in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/proc-import-got-unwanted-variable-when-converting-a-tab/m-p/680268#M23977</link>
    <description>&lt;P&gt;Please open your text file with Notepad, and copy/paste the first few lines into a window opened with the &amp;lt;/&amp;gt; button, so we can see exactly how it is structured.&lt;/P&gt;</description>
    <pubDate>Sun, 30 Aug 2020 07:23:43 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-08-30T07:23:43Z</dc:date>
    <item>
      <title>proc import got unwanted variable when converting a tab-delimited file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/proc-import-got-unwanted-variable-when-converting-a-tab/m-p/680261#M23973</link>
      <description>&lt;P&gt;&lt;FONT size="2"&gt;Hello, everyone,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;I try to use PROC IMPORT to convert a tab-delimited file "class.txt", located at 'C:\base-guide-practice-data\cert' , to a sas data set. Here is my code:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;PROC IMPORT OUT= WORK.CLASS &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;DATAFILE= "C:\base-guide-practice-data\cert\class.txt" &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;DBMS=TAB REPLACE;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;GETNAMES=YES;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;DATAROW=2; &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;RUN;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;There are 3 variables in "class.txt": Name, Gender, Age , But I just got 1 variable: Name_____Gender___Age. All these three are joined together. The log shows the following:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;data WORK.CLASS ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;35 %let _EFIERR_ = 0; /* set the ERROR detection macro variable */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;36 infile 'C:\base-guide-practice-data\cert\class.txt' delimiter='09'x MISSOVER DSD&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;36 ! lrecl=32767 firstobs=2 ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;37 informat Name_____Gender___Age $20. ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;38 format Name_____Gender___Age $20. ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;39 input&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;40 Name_____Gender___Age $&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;41 ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;42 if _ERROR_ then call symputx('_EFIERR_',1); /* set ERROR detection macro variable */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;43 run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;Does someone also get the same issue? I use SAS university edition. Any suggestions? Thanks.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 30 Aug 2020 03:27:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/proc-import-got-unwanted-variable-when-converting-a-tab/m-p/680261#M23973</guid>
      <dc:creator>jkl123</dc:creator>
      <dc:date>2020-08-30T03:27:16Z</dc:date>
    </item>
    <item>
      <title>Re: proc import got unwanted variable when converting a tab-delimited file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/proc-import-got-unwanted-variable-when-converting-a-tab/m-p/680263#M23974</link>
      <description>You can try to use the dlm option. The see the example below:&lt;BR /&gt;&lt;BR /&gt;proc import datafile="C:\temp\test.txt"&lt;BR /&gt;   out=test&lt;BR /&gt;   dbms=dlm&lt;BR /&gt;   replace;&lt;BR /&gt;   dlm=',';&lt;BR /&gt;run;</description>
      <pubDate>Sun, 30 Aug 2020 03:59:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/proc-import-got-unwanted-variable-when-converting-a-tab/m-p/680263#M23974</guid>
      <dc:creator>Cecillia_Mao</dc:creator>
      <dc:date>2020-08-30T03:59:17Z</dc:date>
    </item>
    <item>
      <title>Re: proc import got unwanted variable when converting a tab-delimited file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/proc-import-got-unwanted-variable-when-converting-a-tab/m-p/680268#M23977</link>
      <description>&lt;P&gt;Please open your text file with Notepad, and copy/paste the first few lines into a window opened with the &amp;lt;/&amp;gt; button, so we can see exactly how it is structured.&lt;/P&gt;</description>
      <pubDate>Sun, 30 Aug 2020 07:23:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/proc-import-got-unwanted-variable-when-converting-a-tab/m-p/680268#M23977</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-08-30T07:23:43Z</dc:date>
    </item>
    <item>
      <title>Re: proc import got unwanted variable when converting a tab-delimited file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/proc-import-got-unwanted-variable-when-converting-a-tab/m-p/680271#M23978</link>
      <description>&lt;P&gt;Try using below -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc import datafile = "\path\file.txt"&lt;BR /&gt;out = test&lt;BR /&gt;dbms = dlm&lt;BR /&gt;replace;&lt;BR /&gt;dlm = '09'x;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Sun, 30 Aug 2020 07:58:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/proc-import-got-unwanted-variable-when-converting-a-tab/m-p/680271#M23978</guid>
      <dc:creator>prajakta</dc:creator>
      <dc:date>2020-08-30T07:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: proc import got unwanted variable when converting a tab-delimited file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/proc-import-got-unwanted-variable-when-converting-a-tab/m-p/680281#M23981</link>
      <description>&lt;P&gt;That behavior means that your actual file is very likely NOT tab delimited.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the columns are "nicely" aligned it may mean that this is actually fixed column and not delimited.&lt;/P&gt;
&lt;P&gt;As mentioned, copy a few lines of the file and paste into a code box opened on the forum with the &amp;lt;/&amp;gt; icon.&lt;/P&gt;
&lt;P&gt;The code box is &lt;STRONG&gt;critical&lt;/STRONG&gt; in this case as the message windows will reformat text and the result will almost certainly be other than your actual file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW, did you ever open that "tab" delimited file in Excel? Excel is also known to change things if you aren't extremely careful.&lt;/P&gt;</description>
      <pubDate>Sun, 30 Aug 2020 10:49:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/proc-import-got-unwanted-variable-when-converting-a-tab/m-p/680281#M23981</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-08-30T10:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: proc import got unwanted variable when converting a tab-delimited file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/proc-import-got-unwanted-variable-when-converting-a-tab/m-p/680315#M23984</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello, ballardw&amp;nbsp;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you for your info. My answers to your concern:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(1) This is the example of the base-performance exam book.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(2) I never opened tab-delimited file with Excel.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(3) I tried infile &amp;amp; input statements to read this file and succeeded last night. I believe it's column-fixed file.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(4) The book said it's a tab-delimited file, so I never suspect that point.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(5) See the original file:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;Name     Gender   Age                                                           
Joyce    F        11                                                            
Thomas   M        11                                                            
Jane     F        12                                                            
Louise   F        12                                                            
James    M        12                                                            
John     M        12                                                            
Robert   M        12                                                            
Alice    F        13                                                            
Barbara  F        13                                                            
Jeffery  M        13                                                            
Carol    F        14                                                            
Judy     F        14                                                            
Alfred   M        14                                                            
Henry    M        14                                                            
Jenet    F        15                                                            
Mary     F        15                                                            
Ronald   M        15                                                            
William  M        15                                                            
Philip   M        16 &lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 30 Aug 2020 15:30:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/proc-import-got-unwanted-variable-when-converting-a-tab/m-p/680315#M23984</guid>
      <dc:creator>jkl123</dc:creator>
      <dc:date>2020-08-30T15:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: proc import got unwanted variable when converting a tab-delimited file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/proc-import-got-unwanted-variable-when-converting-a-tab/m-p/680321#M23985</link>
      <description>&lt;P&gt;There are no tabs in there, the data as posted is fixed-width. This data step reads it:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
input @1 Name $8. @10 Gender $1. @12 Age 10.;
datalines;                                                        
Joyce    F        11                                                            
Thomas   M        11                                                            
Jane     F        12                                                            
Louise   F        12                                                            
James    M        12                                                            
John     M        12                                                            
Robert   M        12                                                            
Alice    F        13                                                            
Barbara  F        13                                                            
Jeffery  M        13                                                            
Carol    F        14                                                            
Judy     F        14                                                            
Alfred   M        14                                                            
Henry    M        14                                                            
Jenet    F        15                                                            
Mary     F        15                                                            
Ronald   M        15                                                            
William  M        15                                                            
Philip   M        16
; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Remove the DATALINES block and add a simple INFILE statement (no delimiter needed) to point to your file.&lt;/P&gt;</description>
      <pubDate>Sun, 30 Aug 2020 16:27:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/proc-import-got-unwanted-variable-when-converting-a-tab/m-p/680321#M23985</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-08-30T16:27:57Z</dc:date>
    </item>
    <item>
      <title>Re: proc import got unwanted variable when converting a tab-delimited file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/proc-import-got-unwanted-variable-when-converting-a-tab/m-p/680336#M23990</link>
      <description>Hi KurtBremser , thank you. Yes, you're right. I saved that original file&lt;BR /&gt;as tab-delimited and tried the code again. Everything worked well. The&lt;BR /&gt;issue is my external file is not tab-separated. Thanks for everyone's help.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 30 Aug 2020 23:32:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/proc-import-got-unwanted-variable-when-converting-a-tab/m-p/680336#M23990</guid>
      <dc:creator>jkl123</dc:creator>
      <dc:date>2020-08-30T23:32:51Z</dc:date>
    </item>
  </channel>
</rss>

