Importing Text Delimited File
Text file is another file type that is commonly imported by Proc Import.
Let's look at the TXT_Practice_01.txt file.
The text file contains three columns:
The file is also a space-delimited file, which means the values are all separated by a single space.
Let's look at the code to import this file:
When importing a space-delimited file, you need to do the following:
The code above will import the text file properly into SAS:
Comma Delimited Files
Importing a comma-delimited file is similar to importing a space-delimited file.
Let's take a look at the text file named TXT_Practice_02.txt:
The file is a comma-delimited text file, and each value is separated by a comma.
Below is the code to import this file:
The DELIMITER statement tells SAS the file is a comma-delimited file.
SAS will then import the file accordingly:
In the next section, we will learn how to import a tab-delimited file.
Use Proc Import to import the file named TXT_Practice_03.txt.
The delimiter in this file is a dollar sign ($).
filename txt_fl3 '/folders/myfolders/Proc Import Files/txt_practice_03.txt';
proc import datafile=txt_fl3
out = txt_fl3
dbms = dlm
delimiter = '$';