Clinical sas interview questions – Part 2

Clinical sas interview questions:

This is the continuation of clinical sas interview questions for freshers part 1. All are the questions prepared from freshers point of view. In our future post we will provide advanced clinical sas interview questions. Some of these clinical sas interview questions used for experienced employee interviews also.

Continuation of clinical sas interview questions and answers are as follows.

11) what is the building blocks in SAS?

Ans: there are two types of building blocks in SAS.

  1. data step
  2. proc step

The all the programming of the SAS is depending on this two steps. Using data step, we can manage, manipulate, derive the SAS datasets. Means all the data management task completed in the data step.

The proc step is use for the creating the listing output of the SAS dataset which are created in the data step. Also using proc step we will create the TLF (table, listing and figures) of the particular SAS datasets as per our requirements.

clinical sas interview questions pharmaclub

12)  suppose we have given the two datasets brother.one and brother.two shown below

        Data brother.one;  

                Input varX vary;

                Datalines;

       1 yogesh

       3 mayur

       5 pritesh

      ;

     Data brother.two;

             Input varX varZ;

                Datalines;

       2 sunny

       4 rohit

   ;

Now we want to merge this two datasets by varX variable write the syntax and show the output that you will get?

Ans:

Now, for merging these two datasets first we want to sort both SAS datasets and then we will merge it.

The syntax is as follows,

Proc sort data=brother.one out=brother.1;

                By varX;

Run;

Proc sort data= brother.two out=brother.2;

                By varX;

Run;

Data brother.12;

                Merge brother.1 brother.2;

                By varX;

Run;

Here we are getting SAS dataset brother.12 which is the merged SAS dataset.

The output we will get is shown below,

VarXVarYvarZ
1yogesh
2sunny
3mayur
4rohit
5pritesh

 

13) How to create user define format in SAS?

Ans: In SAS we can create our own user define format by using Proc format procedure.

The syntax is as follows,

Proc format;

                Value format_name

“Male” =0

“Female” =1

;

In clinical research many time we want to convert the categorical dichotomous variables into some binary or ordered numerical numbers for that purpose this user define format are most useful.

14) How many types of errors we have in SAS? Explain it in brief?

Ans: There are 5 types of errors occurs in SAS while doing and executing the programme. Which are as follows

  1. syntax error: this error occurs when there Is spelling mistake, missing semicolon in the programme.

Ex:  data ab

                Set abc;

        Run;

In the first statement semicolon is missing.

  1. semantic error: when the programme does not follow the SAS standard rules then this error will be occur.

Ex: dat ab;

                Set abc;

      Run;

Here in the first statement data step keyword is not correct. It will create the semantic error.

  1. execution time error: invalid statement, invalid derivation equation

Ex: dividing some numeric value by Zero.

  1. data error: this types of data errors occur when we assign numeric value as character value in the data.

Ex:

Data ab;

                Input patid weight gender $;

Datalines;

01 45  Male

02 67   1

;

Here gender is the character variable but we assign in 2nd observation it is numeric i.e 1. it will create the data error.

  1. macro error: this types of error occur when we will create the invalid macros in the programme.

15) what is the use of descriptor portion in SAS?

Ans: The descriptor portion of SAS dataset is stored in the memory of SAS and it is shown in the output window. It shows the information about the attributes of SAS dataset variables and when the dataset created, modified, deleted observations, sorted observations all the SAS dataset information is given in the descriptor portion.

The syntax for showing the descriptor portion of SAS dataset

Proc contents data=SASdata_name;

Run;

16) How many default libraries in SAS and explain the use of it?

Ans: there are 3 main default libraries in SAS

  1. SAS user
  2. SAS help
  3. Work library

Within these 3 libraries the SAS user and SAS help are the permeant libraries and work library are the temporary library. It means that files stored in work library are not available if we close the current session of SAS. And permeant libraries are available every time.

A part from it if we want to create our own libraries then we will create it using libname statement.

The syntax is as follows,

Libname name_library “Path of the folder in which we want to store files”;

17) what is the use of log window in SAS?

Ans: when we are executing the program the information about the programming errors and timing as well as observations are created in the log window. It is very useful for the finding the exact location of error in the program. It means that whatever errors in the program we are having we will cure it by using the log window.

18) how many windows available in SAS and Explain use of it in-brief?

Ans: There are five windows in SAS which are as follows,

  1. Editor window: we will write and execute the programme using editor window. All the SAS programming rules are applicable within this window.
  2. log window: this window shows the errors information in the programme and using this window we will find out the exact location of the errors in the programme.
  3. result window: whatever programme submitted which creates the listing output results, graphs it will have created in the result window.
  4. Explorer window: All the SAS by default and use created libraries are shown within this window.

And also we will access our PC system drives like c drive and other drives.

  1. output window: this window shows the listing dataset output, tables listing, and the information about the SAS datasets after execution.

The SAS windows are looks like as follows,

19) How to import the external data files into the SAS software?

Ans: There are many different types of external files are available like XlSX (excel files), CSV (comma separated files), XPT (Xport files), and other software files like R, SPSS, MATLAB, MINITAB. While working of such files in SAS first we need to import it into the SAS standard format.  And there are some procedures available in SAS for importing this external files

Using proc Import procedure we will import the excel and CSV files and using Proc Cport and proc import procedure we will import the Xport external files into the SAS software. And for importing other software vendor files we want to assign the engine of the particular software in the programme.

For EX: suppose we want to import CSV file (data_1) into SAS (Data_2)

The syntax is as follows,

Proc import datafiles = “path of the CSV file with extension”

                                    Out= data_2

                                     Csv =dbms replace;

Run;

 

20) how to convert the SAS dataset horizontal to vertical and vertical to horizontal in SAS?

Ans: within SAS for taking transpose or compliment of the SAS dataset the proc transpose procedure is available. Using this procedure, we will convert the SAS dataset horizontally to vertically and vice versa.

The syntax is as follows,

Proc transpose data =SAS_data_name out= new_Data_name;

                Var variables_names;

Run;

Author: Mayur Kharche

Please share this post and comment your opinion below.