<?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: importing a .dat file into sas in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/importing-a-dat-file-into-sas/m-p/617326#M180880</link>
    <description>&lt;P&gt;I know what a .DTA file usually is (a data file produced by Stata).&amp;nbsp; But I am unaware of any likely convention for .DAT files.&amp;nbsp; Do you know what software produced your .DAT file?&lt;/P&gt;</description>
    <pubDate>Tue, 14 Jan 2020 21:51:09 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2020-01-14T21:51:09Z</dc:date>
    <item>
      <title>importing a .dat file into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-a-dat-file-into-sas/m-p/617318#M180874</link>
      <description>&lt;P&gt;How do you import a .dat file ?&lt;/P&gt;&lt;P&gt;What will be the DBMS value ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;proc import data='C:\users\desktop\mysas\name.dat'&lt;/P&gt;&lt;P&gt;dbms= ?&lt;/P&gt;&lt;P&gt;out= test;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: You cannot open the file to check the content.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 21:13:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-a-dat-file-into-sas/m-p/617318#M180874</guid>
      <dc:creator>CathyVI</dc:creator>
      <dc:date>2020-01-14T21:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: importing a .dat file into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-a-dat-file-into-sas/m-p/617326#M180880</link>
      <description>&lt;P&gt;I know what a .DTA file usually is (a data file produced by Stata).&amp;nbsp; But I am unaware of any likely convention for .DAT files.&amp;nbsp; Do you know what software produced your .DAT file?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 21:51:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-a-dat-file-into-sas/m-p/617326#M180880</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-01-14T21:51:09Z</dc:date>
    </item>
    <item>
      <title>Re: importing a .dat file into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-a-dat-file-into-sas/m-p/617333#M180884</link>
      <description>&lt;P&gt;A .dat extension is very generic. It tells us nothing about the way the file is constructed. Please elaborate on the contents. Having said that, this is very concerning:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Note: You cannot open the file to check the content&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;How can one possibly advise without checking the contents?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;-- Jan.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 22:13:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-a-dat-file-into-sas/m-p/617333#M180884</guid>
      <dc:creator>jklaverstijn</dc:creator>
      <dc:date>2020-01-14T22:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: importing a .dat file into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-a-dat-file-into-sas/m-p/617335#M180886</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/253321"&gt;@CathyVI&lt;/a&gt;:&lt;/P&gt;
&lt;P&gt;Do not use proc IMPORT. Use the DATA step: It has no objections to any extension and will read the file as long as it is readable. For example, I've created a test text file with 2 records, renamed it using the .dat extension, and, lo and behold:&lt;/P&gt;
&lt;PRE&gt;1  filename in "C:\Users\sashole\Documents\test\test.dat" ;                                                                             
2                                                                                                                                       
3  data _null_ ;                                                                                                                        
4    infile in ;                                                                                                                        
5    input ;                                                                                                                            
6    put _infile_ ;                                                                                                                     
7  run ;                                                                                                                                
                                                                                                                                        
NOTE: The infile IN is:                                                                                                                 
      Filename=C:\Users\sashole\Documents\test\test.dat,                                                                                
      RECFM=V,LRECL=32767,File Size (bytes)=22,                                                                                         
      Last Modified=14Jan2020:17:23:56,                                                                                                 
      Create Time=14Jan2020:17:23:56                                                                                                    
                                                                                                                                        
1234567890                                                                                                                              
XYZABCQWER                                                                                                                              
NOTE: 2 records were read from the infile IN.   
&lt;/PRE&gt;
&lt;P&gt;Kind regards&lt;/P&gt;
&lt;P&gt;Paul D.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 22:33:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-a-dat-file-into-sas/m-p/617335#M180886</guid>
      <dc:creator>hashman</dc:creator>
      <dc:date>2020-01-14T22:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: importing a .dat file into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-a-dat-file-into-sas/m-p/617350#M180895</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/253321"&gt;@CathyVI&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: You cannot open the file to check the content.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DAT files are just text files with data in them 90% of the time.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Open the text file in an editor and examine the data and variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use the 'show invisible characters' feature in your text editor to see what the delimiter is, often it's a space, tab or even a comma.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Then you can import it in SAS either using a custom data step or specifying the appropriate DBMS according to the delimiter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your file is some other format, there's almost no way for us to know what it is or how to handle it otherwise.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/253321"&gt;@CathyVI&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;How do you import a .dat file ?&lt;/P&gt;
&lt;P&gt;What will be the DBMS value ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example:&lt;/P&gt;
&lt;P&gt;proc import data='C:\users\desktop\mysas\name.dat'&lt;/P&gt;
&lt;P&gt;dbms= ?&lt;/P&gt;
&lt;P&gt;out= test;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: You cannot open the file to check the content.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 23:43:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-a-dat-file-into-sas/m-p/617350#M180895</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-01-14T23:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: importing a .dat file into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-a-dat-file-into-sas/m-p/670078#M201109</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Can you please try this code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC IMPORT DATAFILE = '/folders/myfolders/data/np_traffic.dat'&lt;BR /&gt;OUT = np&lt;BR /&gt;DBMS = DLM REPLACE;&lt;BR /&gt;DELIMITER="|";&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jul 2020 08:17:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-a-dat-file-into-sas/m-p/670078#M201109</guid>
      <dc:creator>Kalai</dc:creator>
      <dc:date>2020-07-17T08:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: importing a .dat file into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-a-dat-file-into-sas/m-p/685112#M207738</link>
      <description>&lt;P&gt;This works! Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Sep 2020 21:05:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-a-dat-file-into-sas/m-p/685112#M207738</guid>
      <dc:creator>carmenvila</dc:creator>
      <dc:date>2020-09-18T21:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: importing a .dat file into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-a-dat-file-into-sas/m-p/708266#M217644</link>
      <description>&lt;P&gt;Proc Import datafile="/folders/myfolders/EPG1V2/data/np_traffic.dat"&lt;BR /&gt;dbms=dlm out=work.traffic2 replace;&lt;BR /&gt;guessingrows=max;&lt;BR /&gt;delimiter="|";&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There you go I actually managed to do it myself without looking at the solution &lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt; (for the base SAS training).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yeah as one other person said, you would have to open the file to find out what the delimiter is. For a CSV it would be a comma, but for a data file, you wouldn't know so you would have to check. In my example, the delimiter was a | so I used the delimiter= option to tell that to SAS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess in your case you could try a guess and check method to see what the delimiter is until you get it right.&lt;/P&gt;</description>
      <pubDate>Sat, 26 Dec 2020 13:28:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-a-dat-file-into-sas/m-p/708266#M217644</guid>
      <dc:creator>Kedarnath_M</dc:creator>
      <dc:date>2020-12-26T13:28:34Z</dc:date>
    </item>
    <item>
      <title>Re: importing a .dat file into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-a-dat-file-into-sas/m-p/708267#M217645</link>
      <description>&lt;P&gt;No need to guess. Just look at the file.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  infile "/folders/myfolders/EPG1V2/data/np_traffic.dat" obs=5 ;
  input;
  put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 26 Dec 2020 15:18:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-a-dat-file-into-sas/m-p/708267#M217645</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-12-26T15:18:47Z</dc:date>
    </item>
    <item>
      <title>Re: importing a .dat file into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-a-dat-file-into-sas/m-p/708269#M217647</link>
      <description>&lt;P&gt;Sweet,&amp;nbsp;I downloaded the file and opened it with TextEdit, but this more convenient.&lt;/P&gt;</description>
      <pubDate>Sat, 26 Dec 2020 15:31:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-a-dat-file-into-sas/m-p/708269#M217647</guid>
      <dc:creator>Kedarnath_M</dc:creator>
      <dc:date>2020-12-26T15:31:11Z</dc:date>
    </item>
    <item>
      <title>Re: importing a .dat file into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-a-dat-file-into-sas/m-p/708282#M217652</link>
      <description>&lt;P&gt;Also try the LIST statement.&amp;nbsp; Very useful when the file contains tabs (or other non-graphic characters) since SAS will then display the hexadecimal code for the characters in two lines aligned underneath the actual line of text.&amp;nbsp; It will also display the number of bytes in the line.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  infile "/folders/myfolders/EPG1V2/data/np_traffic.dat" obs=5 ;
  input;
  list;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Dec 2020 16:32:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-a-dat-file-into-sas/m-p/708282#M217652</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-12-26T16:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: importing a .dat file into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-a-dat-file-into-sas/m-p/806743#M317912</link>
      <description>&lt;P&gt;use "dlm" as dbms value and add delimiter="?" step in code where "?" is the delimiter you need to define looking at the data in your .dat file.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2022 11:11:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-a-dat-file-into-sas/m-p/806743#M317912</guid>
      <dc:creator>subhash747</dc:creator>
      <dc:date>2022-04-08T11:11:08Z</dc:date>
    </item>
    <item>
      <title>Re: importing a .dat file into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-a-dat-file-into-sas/m-p/806744#M317913</link>
      <description>&lt;P&gt;for example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc import datafile="/home/data/xyz.dat" dbms= dlm&lt;BR /&gt;out=xyz_import replace;&lt;BR /&gt;guessingrows=max;&lt;BR /&gt;delimiter="|"&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2022 11:12:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-a-dat-file-into-sas/m-p/806744#M317913</guid>
      <dc:creator>subhash747</dc:creator>
      <dc:date>2022-04-08T11:12:51Z</dc:date>
    </item>
  </channel>
</rss>

