My SAS Tutorials

Sunday 19 January 2014

Nettpositive Interview Questions

NetPositive Interview Questions       
Written test had four questions.
1.       Base:
Four  variables  names with type and length were provided along with a page of conditions and specifications for each variable. A program had to be written for creating variables, also, array had to be used to perform a temporary look up and sub setting if statement was to be used in the program.

2.       Macro:
Dataset1:
Seq1  var1 var2
100  10    1
200  20    2
300  30    3

Dataset2:
Seq2 var3 var4
400  100    1
200  200    2
200  300    3

Dataset3:
Seq3 var5 var6
400  100    1
200  200    2
200  300    3

Data dataset4 ;
Set dataset1;
If _n_=1 then do ;
Temp1=var1+va2;
Temp2=var1/var2;
End;
Run;

Data dataset5;
Set dataset2;
If _n_=1 then do ;
Temp3=var3+va4;
Temp4=var3/var4;
End;
Run;


Data dataset6;
Set dataset3;
If _n_=1 then do ;
Temp5=var5+va6;
Temp6=var5/var6;
End;
Run;

Write a single macro program for the above three different programs.

3.       Merging:
Dataset1:
Seq  var1 var2
1     10    1
2    20    2
3    30    3

Dataset2:
Seq  var2 var3
1   100    1
3   200    2
3   .         4
4   300    3

Write the output for the following programs.

Data  _1;
Merge dataset 2 dataset1;
By seq;
Run;

Data _2;
Merge dataset1 dataset2;
By seq;
If first.seq and last.seq;
Run;

Data _3;
Merge dataset2(in=one)  dataset1(in=two);
By seq;
If  one and not  two;
Run;






4.       Efficiency:
If the dataset has one million of observations, which one of the following program is more efficient in terms of reducing the cpu time.


Partial dataset:
Dataset:
Var3 Seq1  var1 var2
US    100  10    1
EU    200  20    2
IND  300  30    3

Program No.1
Data US IND EU;
Set dataset;
If var3=‘US’ then output US;
If var3=’EU’ then output EU;
If var3=’IND’ then output IND;
Run;

Program no. 2
%macro report(country);
Data &country;
Set dataset;
If var3= ‘’&country ‘’ then output &country;
Run;
%mend report;
%report(US)
%report(EU)
%report(IND)
Face to face technical round:
1.       Tell me about your experience in SAS.
2.       How good are you in Macro?
3.       How do you define a variable( a macro variable)?
4.       You have a workbook test.xls. How do you access that into SAS?
5.       What are the uses of SAS ACCESS software?
6.       Have you come across DMS, any experience on that?
7.       There are two employees, x and y. Suppose the sum of their age and difference of their age is 80 and  20, respectively. What are the ages of employees? No pen and paper- one min to answer.
8.       There is a list of employee ID and every month a new employee is added. Write a Macro program to cross check the uniqueness of the employee ID. 


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


1 comment:

  1. Answer for Write a single macro program for the above three different programs.



    data chandu1;
    input Seq1 var1 var2;
    cards;
    100 10 1
    200 20 2
    300 30 3
    ;
    run;

    data chandu2;
    input Seq2 var3 var4;
    cards;
    400 100 1
    200 200 2
    200 300 3
    ;
    run;
    data chandu3;
    input Seq3 var5 var6;
    cards;
    400 100 1
    200 200 2
    200 300 3
    ;
    run;

    %macro mymerge (n);

    %do i=1 %to &n. ;
    %let x=%eval(&i.+ 3);data chandu&x.;
    set chandu&i. ;
    %If &i.=1 %then %do ;
    Temp1=var1 + var2;
    Temp2=var1 / var2;
    %end;
    %else %if &i.=2 %then %do ;
    Temp3=var3 + var4;
    Temp4=var3 / var4;
    %end;
    %else %do;
    Temp5=var5 + var6;
    Temp6=var5 / var6;
    %end;
    %end;
    Run;
    %mend;

    %mymerge(3);

    data chandu1;
    input Seq1 var1 var2;
    cards;
    100 10 1
    200 20 2
    300 30 3
    ;
    run;

    data chandu2;
    input Seq2 var3 var4;
    cards;
    400 100 1
    200 200 2
    200 300 3
    ;
    run;
    data chandu3;
    input Seq3 var5 var6;
    cards;
    400 100 1
    200 200 2
    200 300 3
    ;
    run;

    ReplyDelete