Base SAS Interview Questions

Ratings:
(4)
Views:0
Banner-Img
  • Share this blog:

Describe CROSSLIST option in  TABLES statement?

Adding the CROSSLIST option to TABLES statement displays crosstabulation tables in ODS column format.

What is a PDV?

A PDV or Program Data Vector is a logical area in the memory. SAS creates a database of one observation at a time. At the time of compilation an input buffer is created which holds a record from and external file. The PDV is created following this input buffer creation.

How would you remove a format that has been permanently associated with a variable?

We can remove the format by using proc datasets:
Proc datasets;
modify <data set name>;
format <variable name>(which variable format needs to
modify>;
run;
quit;

Explain what is the use of PROC gplot?

PROC gplot has more options and can create more colorful and fancier graphics.

Enthusiastic about exploring the skill set of SAS Training? Then, have a look at the blog post to gather
 additional knowledge.

What is the difference between One to One Merge and Match Merge? Give example also.

If both data sets in the merge  statement are sorted by id(as shown below) and each observation in one data set has a corresponding observation in the other data set, a one-to-one merge is suitable.

data mydata1;

input id class $;

cards;

1 Sa

2 Sd

3 Rd

4 Uj

;

data mydata2;

input id class1 $;

cards;

1 Sac

2 Sdf

3 Rdd

4 Lks

;

data mymerge;

merge mydata1 mydata2;

run;

If the observations do not match, then match merging is suitable

data mydata1;

input id class $;

cards;

1 Sa

2 Sd

2 Sp

3 Rd

4 Uj

;

data mydata2;

input id class1 $;

cards;

1 Sac

2 Sdf

3 Rdd

3 Lks

5 Ujf

;

data mymerge;

merge mydata1 mydata2;

by id

run;

Describe an SAS function.

TRIM: removes trailing blanks from a character expression

data xyz; Str1 = ‘my’; Str2 = ‘dog’; Result = TRIM(Str1)||TRIM(Str2); run;

Which SAS Statement does not perform automatic conversions in comparisons?

 The “where” statement does not perform automatic conversions in comparisons.
How do you specify variables to be processed by the FREQ procedure?

Use the TABLES statement.

In SAS interviews it’s a good idea to try and keep your answers precise as this helps you come across as confident. Being able to answer questions succinctly is also a very clear indicator of your knowledge.

What is the difference between Merge and Proc SQL ?

The resultant dataset depends on the input datasets. In case of one to one and one to many  both work similarly,i.e. the resultant dataset is same. But differs in case of many to many and non matching datasets: many to many: ex:                                     (merge on x)         (proc sql) X  Y              X    Z           X  Y  Z                X  Y  Z -----             ------            -------                 ------- 1  A              1    F            1  A  F                 1  A  F 1  C              1    R --->      1  C  R                 1  A  R 2  B              2    G            2  B  G                1  C  F 1  C  R 2  B  G

NON MATCHING DATA:

ex:                                       (merge on x)    (proc sql) X  Y              X    Z              X  Y  Z          X  Y  Z -----             ------                -------           ------- 1  A              1    F            1  A  F           1  A  F 2  B              3    T    --->    2  B  .            3  C  T 3  C              4    G            3  C  T 4  .  G

How will you write a code to create a sas dataset with no data in it/ Or How to validate a dataset without actual creating it?

Use OPTIONS OBS = 0

Creating a data set by using the like clause.
 ex: proc sql;
create table latha.emp like oracle.emp;
quit;
In this the like clause triggers the existing table structure to be copied to the new table.using this method
result in the creation of an empty table.
 data check;
           set _null_;
     run;
data test;
        delete;
    run;
check the above answers.. I have not verified if it will work.

What is a PUT statement?

A PUT statement is a flexible tool in data step programming.

Examples of a PUT statement are:

PUT _all_ - writes the values of all variables

PUT 132*’_’ – writes 132 underscores

PUT one two three – writes three variable values separated by a space.

Mention the category in which SAS Informats are placed?

SAS informats are placed in three categories,

-Character Informats : $INFORMATw

-Numeric Informats : INFORMAT w.d

-Date/Time Informats: INFORMAT w.

What function CATX syntax does?

CATX syntax concatenate character strings remove trailing and leading blanks and inserts separators.

 

What is the difference between Order and Group variable in proc report?

-If the variable is used as group variable, rows that have the same values are collapsed.

-Group variables produce list report whereas order variable produces summary report.

How to specify variables to be processed by the FREQ procedure?

By using TABLES Statement.

Does SAS Translate? (compile) or does it ?Interpret?? Explain.

A typical SAS program could contain DATA steps, PROC steps and macros. Macros are preprocessed. DATA steps are just in time compiled. PROC steps are interpreted in the order they appear in program. So when we submit a SAS program consisting of all these three components, the macro is compiled and executed first. If a DATA step is encountered, then it is compiled and executed. Note that the DATA step will not be executed if there is an error in the compilation. If a PROC step is encountered, it is interpreted and executed line by line. However i am not certain on this PROC step behavior.

 

If you have a data set that contains 100 variables, but you need only five of those, what is the code to force SAS to use only those variable?

Use KEEP option on a dataset to only select few variables from 100 variables. We can use KEEP option either on set statement or data step statement. If we use on SET statement then only the five variables are created on pdv and only these variables are sent to the output dataset. If we use KEEP option on data step statement then all the variables are copied into pdv and after any maniuplation only the selected variables on data step statement are processed and sent to output dataset.
 

You liked the article?

Like : 0

Vote for difficulty

Current difficulty (Avg): Medium

Recommended Courses

1/15

About Author
Authorlogo
Name
TekSlate
Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.


Stay Updated


Get stories of change makers and innovators from the startup ecosystem in your inbox