Clinical sas programmer interview questions for freshers –Part 3

This post was most recently updated on

Clinical sas programmer interview questions for freshers 

This is the continuation of clinical sas programmer interview questions part2.

21) how to assign the title and footnotes for the created report or tables?

Ans: we can create the title and footnotes in SAS using title and footnote statement.

The syntax is as follows,

Title1 “  the demographic results for patient n=20 “ ;

Title are visible at the top of the report or table.


Footnote1 “ here we are in this table we are having the 2 dropouts”;

And footnote are visible at the bottom of the report or table.

We will create the 10 title and and 10 footnote at a time in SAS. If we assign the same title or footnote two time in SAS programme it will override to next one and like that output will be create in the report window.

Related: Phases of clinical trials- Overview

22) how to convert the SAS report and output tables into the external files?

Ans: there are many external reporting files are available for submitting the reports and dataset. Which are as follows,

  1. pdf (portable data file)
  2. rtf (rich text file)
  3. txt (text file)
  4. doc (word file)

Many time we want to convert our SAS output report and outputs into this external reporting files. For that within SAS output delivery system (ODS) is the statement available.

For EX:

Suppose, we want to make PDF file output

The syntax is as follows.

Ods pdf file = “path with extension where we want to create the file”;

Proc print data=sashelp.class;


Ods pdf close;

Whichever program are mentioned within first ods and last ods statement that output will be created in the pdf file.

clinical sas programmer interview questions pharmaclub

23) what is the use of array in SAS programme?

Ans: suppose if we want to do same task repeatedly many time say 20 time. If we are going by traditional way, we want to make programme 20 times. It will take lots of time and hard work. By using array, we will do it by using the single programme. It will reduce time as well as hard work.

i.e by using array we will make the series of observation into single variable.

The syntax of array is as follows,

Array array_name (n) Array_values;

24) suppose we have given the following programme

Libname abcd “path of folder”;






What output we will get for variable D?

Ans: In SAS different operators are available for making some expression or calculations.

  1. exponential operator (**) means (^)
  2. subtraction (-)
  3. multiplication (*)
  4. addition (+)
  5. division (/)

Here in our programme it is an exponential operator

Here A =4 and b=7

So we will get

C=a*b=4**7 =16384

We will get this output in the output window.

25) what is the use and difference of drop and keep statement as well as options in SAS?

Ans: the drop and keep options we are using independently in the options statement. As well as in set statement and data step.

The syntax is

Options drop=var_a keep=var_c; * means we are droping here variable var_a and keeping variable var_c;

Also we can use in data and set statement.


Data abc (keep=var_a);

 Set abc1 (drop=var_abc);


 Now, drop and keep statement we will be use in the data set for dropping and keeping the variables.


Data abc ;

Set abcd;

Drop var_1;

Keep var_2;


26) How to deal with the missing date values in SAS?

Ans: In SAS while working on the data some time we are having some missing date values.

For example:

Data abc;

 Input date &;




Here we want this date as in some century.

Date= 21/07/18 here we don’t know this date belongs to which century.

Within SAS we are having yearcutoff option which creates the 100 years’ time span.

The by default yearcutff value is 1920 that is it will create (1920-2019) this 100 years’ time span.


Here our data =21/07/18 are come under 2018 century. So this 21/07/2018 will be shown in the output. Like that we are dealing with the missing date values in SAS.

27)  what is the use of proc print procedure?

Ans: this is the procedure in SAS which shows the listing output of the SAS dataset in the output window. Also we can restrict the listing dataset for showing the observations that we don’t want in the output window using obs and firstobs option.

For Ex.

Suppose we are having SAS dataset sys_bp which contain 20 observations

Now we want to show listing output and only first 10 observations.

Data SYS_bp;

 Set SYS_bp2;


Proc print data=sys_bp firstobs=1 obs=10;


That is, we will get the listing output for only first 10 variables in the output window.

28) Suppose we are having the SAS dataset

Data ab;

 Input pid gender $ 6.;


01 Male;

02 Female;

03 Male;

04 Female;


Now we want to convert this male and female values in binary number 0 and 1.

Write the programme for it?


Here for doing this task we want to use here conditional looping or also we will do it by creating our own user defined format. In SAS there are many ways for doing one task or thing differently.

First we will do it using conditional looping

Data ab;

 Input pid gender $ 6.;

 If gender=” Male” then sex=1;

 Else if gender =” female” then sex=0;


Now we can do it using proc format

First we will create the user defined format

Proc format;

 Value gender$

 “Male” = 1



Data ab;

   Input pid gender $ 6. ;

 Format gender$.;


01 Male;

02 Female;

03 Male;

04 Female;


29) what is the SAS standard rule for the naming and assigning length for character and numeric variable in SAS?

Ans: In SAS for each type of variables we are having some SAS standard rules which is as follows

  1. Character variables: this variable contains only A-Z letters, and special characters.

The maximum length of the character variables is 32k means (32767 bytes). For 1-character digit it will take the 1 bytes.

  1. numeric variable: this variable contains the 0-9 digits, E notations etc.

The maximum length of the numeric variable Is 8 bytes which is very huge length lots of numeric values comes under this length.

Also for assigning label length is 256-character long. If it exceeds the 256 character, then SAS programme shows the error in the log window.

30) what is the use of where statement in SAS?

Ans: In practically when we are working in clinical related fields many time we want to subset the dataset or categorise the dataset for doing it where statement is very useful.

To create the subset of the larger dataset where statement is used.

For Ex: Suppose, we are having the demographics data which contains all the demographics information of (n=50) patients. But we want only those patients for the analysis whose age is greater than 18. By using where statement we can do it.

Programme is as follows,

Data abc;

 Set abc1;

 Where age > 18;


Here we will get new SAS dataset abc which contains all observations for those patients age is greater than 18.

Author: Mayur Kharche (Clinical sas programmer& Biostatistician)

Please share this post and comment your opinion below. If you need any other clinical sas programmer interview questions feel free to drop a comment below.

Leave a Reply

Your email address will not be published.