How do you read data from an external file in SAS?

Boost your career with the SAS Base Exam Certification. Dive into multiple choice questions, detailed explanations, and flashcards to enhance your understanding and ace your exam!

The correct method to read data from an external file in SAS involves using the INFILE and INPUT statements. The INFILE statement specifies the external file's location, while the INPUT statement defines how the data should be read and formatted into SAS variables. This approach allows for precise control over how data is processed, including handling different delimiters, reading specific records, and managing formatted data.

In contrast, while importing through the Import Wizard (the second choice) can also read data, this method is more of a graphical interface approach suited for those who prefer not to write code manually. It may not provide the same level of scriptable flexibility as using INFILE and INPUT.

Executing a DATA step using the DATA statement (the third choice) is relevant but is not the complete answer. While a DATA step is essential to create SAS datasets, it needs the INFILE and INPUT statements to actually read data from an external source.

The LIBNAME statement (the fourth choice) is used to assign a library reference to a directory containing data files but does not directly read or import data itself. It setup references rather than define the data import process.

Therefore, the combination of the INFILE and INPUT statements in a DATA step is the correct approach for reading external data

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy