My SAS Tutorials

Saturday 29 September 2012

Base SAS interview Questions II

1>
 data  ;
 set one;
  run;
What is the name of the dataset which is getting created by the data statement?

2>
Data one;
set two;
x=substr('fname',3,2);
y=substr(fname,2,3);
run:

Suppose fname is character variable having length 10.What will be the length and type of the variable X and Y which we are creating?

3>
data one;
x='abc';
x=456;
run;
what is the length and type of the X variable?

4>
data one;
x=cat('india',123);
run;

what will be the length ,type and observation of X variable?

5>
data one;
x='india'||560033||scan('delhi is the capital of india',6);
run;

what is the length,type and observation of X variable which we are creating?

6>
data one;
set two(keep=month:)
run;

Suppose dataset two has salary,age, month1,month2,month3 variables? What will be the name of variables in data set one?

7>

         one                                                  Two

Name     Age   Salary                           E_ID    Name
Ram        21      500                              101      Ram
Sita         21      600                               102     Ravan
Ravan     24      800                               103      Sita
Siva        25      900

Data ;
merge one two;
run;

What will be the name of the dataset created? What will be the variable names and varaiable values in the created data set?

8>

     one                                                  Two

Name     Age   Salary                           E_ID    Name
Ram        21      500                              101      Ram
Sita         21      600                               102     Ravan
Ravan     24      800                               103      Sita
Siva        25      900


Data  three;
set one two;
run;



What will be the variable names and varaiable values in the created data set?

9>


     one                                                  Two

Name     Age   Salary                           E_ID    Name
Ram        21      500                              101      Ram
Sita         21      600                               102     Ravan
Ravan     24      800                               103      Sita
Siva        25      900


Data  three;
set one;
set  two;
run;

What will be the variable names and varaiable values in the created data set?

10>


   one                                                  Two

Name     Age   Salary                          Age    Name
  $10       $2        N8                             N 8        $7
Ram        21      500                              21      Ram
Sita         21      600                               22     Ravan
Ravan     24      800                               23      Sita
Siva        25      900

Data ;
merge one two;
by age;
run;

What will be the name of the dataset created? What will be the variable names and varaiable values in the created data set?

11>


               one      
                                        
Name     Age   Salary                         
  $10       $2        N8                            
Ram        21      500                            
Sita         21      600                            
Ravan     24        .                            
Siva        25      900


data three ;
set one ;
x=sum(salary);
y+salary;
z=x+y;
run;

What will be there in the SAS dataset three?

12>


  one                                                  Two

Name     Age   Salary                          Age    Name
  $10       $2        N8                             N 8        $7
Ram        21      500                              21      Ram
Sita         21      600                               22     Ravan
Ravan     24      800                               23      Sita
Siva        25      900




Data four ;
merge one two;
by age;
run;

Merge data set one and two by age to have only matching portions?


13>



  one                                                  Two

Name     Age   Salary                          Age    Name
  $10       $2        N8                             N 8        $7
Ram        21      500                              21      Ram
Sita         21      600                               22     Ravan
Ravan     24      800                               23      Sita
Siva        25      900




Data four ;
merge one two;
by age;
run;

Merge data set one and two by age to have only non- matching portions? 



14>


one                                                  Two

Name     Age   Salary                          Age    Name
  $10       $2        N8                             N 8        $7
Ram        21      500                              21      Ram
Sita         21      600                               22     Ravan
Ravan     24      800                               23      Sita
Siva        25      900

Create SAS data set three by interleaving SAS data sets on and two by age variable?

15>


             one      
                                        
Name     Age   Salary                       
  $10       $2        N8                           
Ram        21      500                            
Sita         21      600                            
Ravan     24        .                            
Siva        25      900

Create a SAS data set one by reading SAS data set one and  recreate variable age having type numeric and length 6 bytes?

16> How to find maximum salary by using data step without using porc sort from SAS data set one?

one

salary
500
600
300
100
150
700
150
1000

17> How to find minimum salary by using data step without using porc sort from SAS data set one?

one
salary
500
600
300
100
150
700
150
1000

Now prepare your Base SAS and Advance SAS Certification Exams with Online Mock tests:  http://exam.sankhyana.com

For training related info kindly mail us at info@sankhyana.com
Sankhyana Consultancy Services
www.sankhyana.com

Friday 28 September 2012

Base SAS Interview Questions I

1>What is SAS?
2>What are the differences between data step and proc step?
3>what are the differences between if and where statements?
4>What is the use of By statement in Proc print?
5>What are the differences between concatenation and merging?
6>What is the maximum length which we can assign to character and numeric variable?
7>What are the differences between proc means and proc summary?
8>What are the differences between nodup and nodupkey in proc sort?
10>How to rename a SAS dataset by using SAS?
11>How to delete a SAS dataset by using SAS programs?
12>What is the use of in= option in set statement?
14>How to create RAW dataset by using SAS Programs?
15>What is the difference between @ and @@?
16>What is _infile_?
17>What is PDV?
18>What is the difference between SAS 9.2 and SAS 9.3?
19>How to create lookup tables by using arrays?
20>How to make permanent formats?
21>Explain compilation and execution phase of a SAS Datastep?
22>When PDV is initialized and reinitialized?
23>Why labels and formats assigned in data steps are permanent and in proc steps it's not?
24>What are the differences between labels and variable names?
25>What is the use of ID Statement in proc transpose?
26> What is the use of var statement in proc transpose?
27>What is the use of By statement in proc transpose?
28>What are the differences between do until and do while?
29>What are the special where operators?
30>What are the differences between by statement and class statement?
31>How to read Excel worksheets by using SAS?
32>How to create Excel worksheets using SAS?
33>What we can do with proc datasets?
34> What is proc univariate?
35>What is the difference between Sum Statement and Sum function?
36>What are the uses of retain statement?
37>What are the differences between cat,catt,catx,catx function?
38>What are the differences between Put and Input functions?
39>What is the difference between point and index functions?
40>What is yearcutoff option?
41>What are different types of merging?
42>What is the use of update statement in data Step?
43>What are the differences between Proc append and concatenation?
44>Why where statement works only on already existing data set variables?
45>What are the types of Raw data sets?
46>What is the difference between Keep/Drop statements and keep= /Drop= options?
47>What are the differences between formats and informats?
48>What is the difference between  workbook,worksheets and ranges in Excel?
49>Why work is temporary and SASHELP,SASUSER are permanent libraries?
50>What is the difference between put statement, putlog Statement and put function?
51>What is the difference between file and infile statement?
52>What is the use of %include statement?
53>What is the use of _NULL_ in data statement?
54>What is the difference between Error,Warning and Note in the SAS log?
55>Name five Compile time and five Execution time statements?
56>What is the maximum numbers of title and footnotes which we can assign to a SAS datasets?
57>What is the default SAS title?
58>What is the minimum length of numeric variable in the PDV?
59>What is the maximum length of libref,labels,variable names?
60>What is the difference between if ,if then and if then else statements?
61>What is the use of _N_ and _ERROR_ in SAS?
62>How to print _N_ and _ERROR_ in the external files?
63>What is the default Name of SAS data set variable which SAS is creating for you in the SAS data set?
64>What is the use in=option in merge statement?
65>Why we are using SAS name literals?
66>When SAS is going for automatic numeric and charcter conversion?
67>How to pad numeric variables with 0's?
68>When SAS is going for best12. format?
69>How to rename a variable?
70>What is the use of Varnum option?
71>What is the use of nway option in proc means?
72>How to rename a varaible in the dataset?
73>What is the difference between global options and local options?
74>Why we can not make lookup tables in procedures?
75>What is the use of force option in proc append and proc sort?
76>What is the difference between lookup tables and SAS datasets?
77>What is happening in the compilation phase of the data steps?
78>What is happening in the execution phase of the data steps?
79>How to create datsets using proc freq and proc means?
80>How many procedures do you know in SAS?
81>How to create indexes by using Data step?
82>How to create views by using Data step?
83>What is the difference between Data step and proc SQL?
84>When PDV is initialize and reinitialize in case of merging?
85>What are the prerequisite of merging?
86>When PDV is initialize and reinitialize in case of concatenation?
87>When PDV is initialize and reinitialize in case of interleaving?
88>What is the difference between Run and Quit Statement?
89>What is the difference between if and where statements?
90>Explain Proc Compare?


Now prepare your Base SAS and Advance SAS Certification Exams with Online Mock tests:  http://exam.sankhyana.com


For training related info kindly mail us at info@sankhyana.com
Sankhyana Consultancy Services
www.sankhyana.com