Importing/open .dat-files from SAS

For requesting general information about EViews, sharing your own tips and tricks, and information on EViews training or guides.

Moderators: EViews Gareth, EViews Moderator

Posts: 25
Joined: Tue Dec 13, 2022 4:41 am

Importing/open .dat-files from SAS

Postby MartinsFest » Tue Sep 05, 2023 4:47 am


I will be running a server task to automatically access and update population data in our main workfile using an Eviews-program. However, the department that gave us this data has only given us .dat-files made by SAS. The server does not have SAS installed, and I would prefer it to remain that way.

Using Python's Pandas, one could simply write: "pd.read_csv('path/to/file.dat', delimiter='\t')" to read most .dat-files. Is there an equally elegant solution for Eviews?

Or could you suggest an alternative?

EViews Steve
EViews Developer
Posts: 765
Joined: Tue Sep 16, 2008 3:00 pm
Location: Irvine, CA

Re: Importing/open .dat-files from SAS

Postby EViews Steve » Wed Sep 06, 2023 3:00 pm

While we don't have support for SAS Dat files explicitly, it seems from your Python example that the SAS DAT file is a simple text file that uses tabs as the delimiter. If this is the case, then EViews should be able to read their text files.

After launching EViews, drag the DAT file to the EViews window and follow the Import wizard to see if EViews can read in the file correctly. After a successful import, look at the Capture window for the exact IMPORT command that was generated by the Import wizard so you can repeat the process as a single command.

Here's a code example of reading a simple text file using TAB as the delimiter (no date column):

Code: Select all

import C:\path\to\sas.dat ftype=ascii rectype=crlf skip=0 fieldtype=delimited delim=tab @smpl @all

Return to “General Information and Tips and Tricks”

Who is online

Users browsing this forum: No registered users and 2 guests