Hi @sandeep12
A file is a named area in computer storage. The physical content of a file is just a stream of bits, but different programs can "map" the bits as logical structures that makes sense in the given program, so it can be seen as information containing e.g. a photo, a spreadsheet, lines of text or a two-dimensional table with observations and columns.
A SAS data set is also just a file, but it has a content which SAS sees as two-dimensional tables. The ability to see a file as a two-dimensional table is hidden in a Libnane engine, so a file accessed through a LIBNAME is a SAS data set. SAS has also the ability to make a bridge to tables in a DBMS system or (with limitations) xlsx- and json-files, so the can be seen as SAS data sets.
The libname is essential in SAS. All SAS procedures for statistics and reporting require SAS data sets as input, and data in other logical formats must be converted to SAS data sets before they can be used in statistics and reporting.
The SAS tool to read files and convert them to SAS data sets is the DATA STEP, and I think it was the main purpose with the data step way back, when all input was created as 80 character text lines on punched cards. SAS procedures are controlled by options, but the data step can execute programs of any complexity written in the SAS BASE language.
SAS data sets are accessed through a LIBNAME, but a data step can also access oher types of files declared in a FILENAME. A filename has no engine to supply a logical structure to the file, so a program written in the SAS language is needed to interpret data, e.g. splitting a comma-separated text line into variables.
... View more