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

No comments:

Post a Comment