Delimiters And Delimited Data in SAS

In this blog post we will delve into the world of delimiters as found in the SAS system of data analysis tools. Delimiters are an essential part of SAS without whose guidance SAS would be in some blind inspite of all the data that surrounds it as the data supplied to it either internally or as an external file.

 

sas courses

What are Delimiters?

Delimiters are essentially symbols to SAS that lets SAS know that the data is separate. They distinguish one set or category of data from others. This should give you an idea about how essential a part of data analytics, a delimiter plays.

How are the Delimiters Symbolized?

SAS accepts the following symbols and key strokes as delimiters:

  •  ,
  •  :
  • Tab
  •  ~
  • &
  •  –

How to Import Delimited Data?

This command imports data infile

Data claim_data;

infile datalines dlm = “,”;

Input sex $ name $ claim_amount ; datalines;

Male,Mahesh,15000

Male,Naveen,10000

Female,Neeta,18000

Male,Amit,7500

Female,Geeta,12000

;

run;

data claim_data ;

Infile E:\Project FT\SAS\Course Material\Class 1\Claim Data comma.txt’ dlm = “,”;

Input sex $ name $ claim_amount ;

Run;

What are the Functions of Delimiters?

An INFILE option, the DSD or delimiter-sensitive data serves varied functions. They are as follows:

  • The default delimiters are changed to wanted ones from the default blank.
  • In case a row contains two delimiters, SAS interprets that there is an instance of a case of missing value.
  •  Delimiters also strip the quotes within which character values are placed.

So the command would boil down to:

data claim_data ;

Infile E:\Project FT\SAS\Course Material\Class 1\Claim Data comma.txt’ dsd;

Input sex $ name $ claim_amount ;

Run

How to Read Data from an External CSV file?

Our next task is to read data from external CSV files. In order to do so we have to input the following:

proc import datafile = “E:\Project FT\SAS\Course Material\Class 1\exam_results.csv”

dbms = csv replace out = class_10_result; Getnames = yes; run;

In a Nutshell

What are Format, Informat and DSD?

  • Informat : This command instructs SAS how exactly to going about reading the data.
  • Format : This instructs SAS about the exact way in which to show the details.
  • DSD : This defines how data is separated by a delimiter.
December 1, 2015 6:03 am Published by , ,

, ,

Comments are closed here.

...

Call us to know more

×