3 Ways How to Create an empty DataSet in SAS

3 Ways How to Create an empty DataSet in SAS

In this tutorial we will learn how to create an empty dataset in SAS with all the possible ways.Suppose we’are uncertain about data and in sas it create dataset with default length on the basis of current data available.

To overcome this issue we create empty dataset or structure of table so that there is no issue of data truncation due to default length and this structure can be used for all the future dataset.

3 Ways How to Create an empty  DataSet in SAS

Let’s see how you can create an blank dataset in SAS with user defined requirements :

  • Using LENGTH statement.
  • Using FORMAT statement.
  • Using INFORMAT statement.

Create an empty  DataSet in SAS using LENGTH statement

In this example we have create a EMPTY dataset using LENGTH statement having variables CLASS, NAME and ROLL_NO with user defined requirements.STOP keyword used to avoid writing any output by default it will produce one record if you don’t placed stop statement.

 

DATA EMPTY;
LENGTH CLASS $10. NAME $25. ROLL_NO 3 ;
STOP;
RUN;

Create an empty  DataSet in SAS using FORMAT statement

In this example we have create a EMPTY dataset using FORMAT statement having variables CLASS, NAME and ROLL_NO with user defined requirements.STOP keyword used to avoid writing any output by default it will produce one record if you don’t placed stop statement.

 

DATA EMPTY;
FORMAT CLASS $10. NAME $25. ROLL_NO 3 ;
STOP;
RUN;

Create an empty  DataSet in SAS using INFORMAT statement

In this example we have create a EMPTY dataset using INFORMAT statement having variables CLASS, NAME and ROLL_NO with user defined requirements.STOP keyword used to avoid writing any output by default it will produce one record if you don’t placed stop statement.

 

DATA EMPTY;
INFORMAT CLASS $10. NAME $25. ROLL_NO 3 ;
STOP;
RUN;

 

Hope you are now more clear how you can Create an empty DataSet in SAS. Feel free to comment if you have any query or error you’re while executing this code.

Happy Learning !!