My SAS Tutorials

Sunday 28 April 2013

SAS INTERVIEWS CONCEPTUAL QUESTIONS X

We have a abc.doc file having values:

ram,21,500
sita,22,600
radha,23,700

How to read abc.doc file to make a SAS data set work.abc:


work.abc
---------------

Name    Age    Salary

Ram       21       500
Sita        22       600
Radha    23       700

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
www.sankhyana.com

Thursday 18 April 2013

SAS INTERVIEWS CONCEPTUAL QUESTIONS IX

We have a SAS data set one in which we have a variable Name:

ONE

Name

Ram Kumar m
Sita Singh
Radha Kumari Pathak
Arjun Rana



Write a SAS program to create another SAS data set TWO by reading SAS data set ONE:

TWO


Fname     Mname     Lname

Ram         Kumar        m
Sita                            Singh
Radha      Kumari       Pathak
Arjun                         Rana        
              


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
www.sankhyana.com

Thursday 4 April 2013

SAS INTERVIEWS CONCEPTUAL QUESTIONS VIII

We are reading a raw file:



111 .
.      .
.      .
.      .
.     222


We need  to create a SAS dataset one like this:


                         ONE

Customer_Id            Product_ID
        111                            222


Write most efficient program.(It should be in single datastep) 

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
www.sankhyana.com

Wednesday 3 April 2013

SAS INTERVIEWS CONCEPTUAL QUESTIONS VII


We have a SAS data set:


data one;
input visit $ pt;
datalines;
v1 101
v1 102
v2 101
v2 102
v3 103
v3 101
;
run;

Required Output:



                                  Obs       visit    _101    _102    _103

                                  1              v1          1       1       .
                                  2             v2           1       1       .
                                  3             v3           1       .       1

Program:


data two;
set one;
drop i;
array a[3] _101 _102 _103;
do i=1 to dim(a);
a[i]=1;
end;
run;
proc transpose data=two out=three (drop=_name_);
by visit;
id pt;
run;
data four;
set three;
by visit;
if first.visit;
run;
proc print;
run;



Can anyone help me in write more efficient program than this as we are solving it by using three different steps?

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
www.sankhyana.com

SAS INTERVIEWS CONCEPTUAL QUESTIONS VI


We are creating a user define format $country:


proc format;
value $country AU='australia'
US='United States'
Ind='India'
Sl='Sri lanka';
run;

A SAS Data set:


data one;
infile datalines;
input location $ population;
format location $country.;
datalines;
AU 1500
US 800
Ind 1000
pak 900
Sl 500
NP 300
;
run;
proc print;
run;

This is the output:



                                  Obs    location         population

                                   1     australia           1500
                                   2     United States        800
                                   3     India               1000
                                   4     pak                  900
                                   5     Sri lanka            500
                                   6     NP                   300

In the above scenario we can see that for the observation pak and NP .$country format is not applicable.

Write a program to count the number of observations on which $country (user defined format) is not applied. 

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
www.sankhyana.com