ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories >> Software >> Data-Warehouse
 
  Teradata (22)  Business-Objects (374)  Cognos (385)  Informatica (524)  Crystal-Enterprise-Suite (23)
  Actuate (19)  Ab-Initio (49)  Data-Stage (66)  SAS (273)  Micro-Strategy (8)
  ETL (136)  Data-Warehouse-General (148)
 


 

Back to Questions Page
 
Question
Whats the difference between $, $$, $$$
Rank Answer Posted By  
 Question Submitted By :: Purva
I also faced this Question!!   © ALL Interview .com
Answer
$---    single doollar is system defiend variables

$$---   double dollar is user defined  variabes

$$$---   No idea....(just send me if u know)
 
1
Praveen Kumar Pendekanti
 
 
Answer
$ - These are the system variables like $Bad file,$input 
file, $output file, $DB connection


$$ - Can any one tell me the scenario  with example for 
user defined variables

$$$ - $$$SessStartTime 

$$$SessStartTime returns the initial system date value on 
the machine hosting the PowerCenter Server when the server 
initializes a session. $$$SessStartTime returns the session 
start time as a string value. The format of the string 
depends on the database you are using. 


Thank You
 
1
Purva
 
 
Answer
$$ - is used for Parameter...see the below example

select a,b,c from <table> where <table>.date-$$date_filter

when you define parameter file in the src File directory 
and this should be given in session, if in parameter file 
if you give 10, then above query will be as below

select a,b,c from <table> where <table>.date-10
 
0
Gopal
 
 
 
Answer
$    - session variable
$$   - mapping parameter & variable
$$$  - system variable
 
5
Abidu
 
 
Answer
Mr.purva is corrct,good going
 
0
Frnd
 
 
Question
What is _n_?
Rank Answer Posted By  
 Question Submitted By :: Jaipal Reddy
This Interview Question Asked @   Accenture
I also faced this Question!!   © ALL Interview .com
Answer
This is a data counter variable used in SAS.

..Raghu
 
0
Raghu
 
 
Answer
this option is used to pick up n number of observation from 
particular dataset
 
0
Hymad
 
 
Answer
The value of _N_ represents the number of times the DATA 
step has iterated
 
0
Sru
 
 
Answer
it is a automatic variable.it displayed at which line the 
error is occur
 
2
Brajesh
 
 
Answer
it is a automatic variable.it counts the no. of line and 
displays at which line errors are occur
 
5
Mohini
 
 
Answer
This is nothing but a implict variable created by SAS during
data processing. It gives the total number of records SAS
has iterated in a dataset. It is Available only for data
step and not for procs.

Eg. If we want to find every third record in a Dataset then
we can use the _n_ as follows 
Data new-sas-data-set;
Set old;
if mod(_n_,3)= 1 then;
run;
Note: If we use a where clause to subset the _n_ will not
yield the required result.
 
3
Ravi
 
 
Answer
This is an automatic variable. It is used to count the 
number of obs in dataset.Its added one for every iteration 
of datastep.
 
0
Ashok Kore
 
 
Answer
it indicates number of observations.
 
0
Sirisha
 
 
Answer
its an automatic variable.it shows no. of iterations gone 
through in datastep
 
0
Yuva
 
 
Answer
_ n_ give no.of times data step is itereated .it gives   
correct observations nos only if  IF SUBSET IS NOT USED in 
the datastep
 
0
Vijaibhaskar
 
 
Answer
_n_ is a automatic variable created by SAS.we can use this
like we use any variable that we created ourselfs and it
indicates the number of times SAS has looped through the
data step.
 
0
Madhavi
 
 
Answer
Number of errers during excution time
 
0
Rams
 
 
Answer
SAS variable to count the no of obs read.
 
0
D.vijaya Bhaskar
 
 
Answer
An internal SAS counter in the data step which contains the 
current iteration number of the data step.
 
0
Natraj Boga
 
 
Answer
IT IS AUTOMATIC VARIABLE SHOWS NUMBER OF ITERATIONS.
 
0
Arun
 
 
Answer
Almost all the above answers are right, except one or few.
Here I provide a clear insight into _n_ variable. This is an
automatic variable of PDV(Program Data Vector) that returns
the no. of observations that it has iterated.  There are
such  variables like _error_, end=, in=, first.by-variabke,
last.by-variable,etc.. All these variables will not be
displayed in the target output.
Ex:
data new;
set ora.emp;
if _n_ >= 2 and _n_ <= 6 then output; 
run;
/* as _n_ returns 'n'th observation our statement is to save
those obs when _n_ returns the value between 2 and 6. Hence
 the 5 obs of the specified dataset between second and six
are saved into 'new'.
 
3
Cutepa1
 
 
Answer
_n_ is a automatic variable the function of _n_ is how many 
times the data step begins to execute.
 
0
Suresh B Anisetty
 
 
Answer
The _n_ is a automatic variable which displays the line number.
 
0
Chiranjeevi
 
 
Question
In the flow of DATA step processing, what is the first
action in a typical DATA Step?
Rank Answer Posted By  
 Question Submitted By :: Jaipal Reddy
This Interview Question Asked @   Accenture
I also faced this Question!!   © ALL Interview .com
Answer
When you submit a DATA step, SAS processes the DATA step and
then creates a new SAS data set

Compilation Phase
Execution Phase
 
0
Ravi
 
 
Answer
creation of input buffer and PDV
 
0
Mallikarjuna Reddy
 
 
Answer
1)Compilation Phase

When you submit a DATA step,it reads the input statements 
it creates an input buffer and brings the variables and 
observations.it is a logical memory area.
and pdv brings the observations at a time from input buffer 
and checks the errors.
PDV contains 2 automatic variables _n_ & _error_ ,these 
checks the erros in observations.
_n_ : indicates the no of obs.
_error_: 1 if error occured
         0 if no error
After that it assigns the datavalues to appropriate 
variable and build a sas dataset.

2)Execution Phase
 
4
Latha Reddy
 
 
Answer
SAS CHECKS FOR SYNTAX ERRORS
 
0
Srinivas
 
 
Answer
Compilation phase happens first in data step processing.
during compilation phase, each statement is scanned for  
syntax errors.
 
0
Kiran
 
 
Question
Name statements that are execution only.
Rank Answer Posted By  
 Question Submitted By :: Jaipal Reddy
This Interview Question Asked @   Accenture
I also faced this Question!!   © ALL Interview .com
Answer
proc print data=datasetname; run;
 
0
Daya
 
 
Answer
run;
It is the execution statement
 
0
Ravi
 
 
Answer
run;
 
0
Siri
 
 
Answer
wen we r using proc sql tat time 
quit; is execution statement
 
0
Yuva
 
 
Answer
infile,input,sum statament etc.
 
0
Vanna.mallikarjunareddy
 
 
Answer
The conditional statements IF-THEN/ELSE and theloop 
statements DO UNTIL nad DO WHILE all are execution time 
statements only
 
0
Suresh B Anisetty
 
 
Answer
there many execution statements,some of them are 
DATA
INPUT
CARDS
INFILE
WHERE
LABEL
SELECT 
INFORMAT
FORMAT and the list goes.
 
0
Srilatha
 
 
Answer
execution statements are 

INPUT
CARDS
INFILE
WHERE
LABEL
SELECT 
INFORMAT
FORMAT and the list goes
 
0
Narasimharao
 
 
Question
Name statements that function at both compile and execution
time.
Rank Answer Posted By  
 Question Submitted By :: Jaipal Reddy
This Interview Question Asked @   Accenture
I also faced this Question!!   © ALL Interview .com
Answer
DATA is the statement that function at both compile and
execution time.
 
1
Radhika
 
 
Answer
keep and drop statements  identifies at both compile and 
execution time.
 
2
Ganesh
 
 
Answer
only FORMAT statement
 
0
Suresh B Anisetty
 
 
Question
Identify statements whose placement in the DATA step is
critical.
Rank Answer Posted By  
 Question Submitted By :: Jaipal Reddy
This Interview Question Asked @   Accenture
I also faced this Question!!   © ALL Interview .com
Answer
Data and run statement.
 
0
Payal
 
 
Answer
Input statement
 
0
Madhu
 
 
Answer
DATA STATEMENT
 
0
Rakesh
 
 
Answer
LENGTH statement and 
defining GLOBAL variable in MACRO
 
0
Sandhya
 
 
Question
Name statements that are recognized at compile time only?
Rank Answer Posted By  
 Question Submitted By :: Jaipal Reddy
This Interview Question Asked @   Accenture
I also faced this Question!!   © ALL Interview .com
Answer
FORMAT statement
 
0
Nipun
 
 
Answer
retain,input,infile,informat,format etc.
 
0
Mallikarjuna Reddy.vanna
 
 
Answer
All compile time activities are un-conditions only exists 
at execution time.

LABEL,KEEP,DROP,RENAME,LENGTH,FORMAT,INFORMAT,ATTRIB,BY,WHER
E and ARRAY are all compile time only statements, however 
LABEL is the statement that can be place any where with in 
the DATA step
 
0
Suresh B Anisetty
 
 
Question
At compile time when a SAS data set is read, what items are
created?
Rank Answer Posted By  
 Question Submitted By :: Jaipal Reddy
This Interview Question Asked @   Accenture
I also faced this Question!!   © ALL Interview .com
Answer
_N_ and _error_ items are created at compile time for each 
and every iteration of sas dataset that is being created.
 
0
Swathi
 
 
Answer
only PDV is generated at compilation time, where as _N_ 
_ERROR_ are generated at execution time only.
 
3
Mallikarjuna Reddy
 
 
Answer
PDV and Input buffers are created at compile time . and 
_n_,_error_ were created at compile time
 
0
Thanwi
 
 
Answer
At Compile time SAS creates
1.Input buffer
2.PDV(Program data vector)
3.Descriptor portion of the o/p dataset
 
0
Madhavi
 
 
Answer
At compile time when a sas dataset is read it creates two 
things only.
1)Programm data vector.
2)discriptive protion.
 
5
Ganesh
 
 
Answer
when the sas dataset read pdv will create.input buffer 
creates only at the time of reading raw datafile.at the 
time of creation of pdv --data portion ,and discripter 
portion created.at this time data will read and start the 
iteration of the data step .at the same time  _n _ and  
_error_ are created.
 
0
Ch .sumalatha
 
 
Answer
At compile time it creates input buffer,program data vector 
and discription portion.
Input buffer is the temporary storage of memory with 
variable length.
Pdv is storages lists of system defined var's and user 
defined var's.
Discription portion contains details like when data set is 
created, date , time , no of var's and no of obs etc.
 
0
Madhu
 
 
Answer
SAS compiles the code• At compile time when a SAS data set
is read, what items are created?Automatic variables are
created. Input Buffer, PDV and Descriptor Information•
 
0
Chiranjeevi.p
 
 
Question
Does SAS ‘Translate’ (compile) or does it ‘Interpret’? Explain.
Rank Answer Posted By  
 Question Submitted By :: Jaipal Reddy
This Interview Question Asked @   Accenture
I also faced this Question!!   © ALL Interview .com
Answer
Compile
 
2
Sheetal Jaju
 
 
Answer
compile is the right option.
 
0
Ganesh
 
 
Answer
interpret
 
0
Sirisha
 
 
Answer
complie. When you submit a DATA step for execution, SAS 
checks the syntax of the SAS statements and compiles them, 
that is, automatically translate the statements into 
machine code.
 
0
Juan
 
 
Question
What is the Program Data Vector (PDV)? What are its functions?
Rank Answer Posted By  
 Question Submitted By :: Jaipal Reddy
This Interview Question Asked @   Accenture
I also faced this Question!!   © ALL Interview .com
Answer
PDV (Program Data Vector) is a logical area in  memory where
SAS creates a dataset one observation at a time.
 
0
Poornima
 
 
Answer
When SAS processes a data step it has two phases.
Compilation phase and execution phase.
During the compilation phase the input buffer is created to
hold a record from external file. After input buffer is
created the PDV is created. The PDV is the area of memory
where sas builds dataset, one observation at a time. The PDV
contains two automatic variables _N_ and _ERROR_.
 
0
Nishant
 
 
Answer
To the above answers I like to add a bit of information that
PDV has even more automated variables such as
FIRST.<by-group-variable>, LAST.<by-group-variable>, _END_,
...etc, along with _ERROR_ and _N_ where each has got its
own significance to have a control over the execution of a
SAS Program.
 
0
Cutepa1
 
 
Answer
It is a logical area in memory where SAS builds a data set, 
one observation at a time. When a program executes, SAS 
reads data values from the input buffer or creates them by 
executing SAS language statements. The data values are 
assigned to the appropriate variables in the program data 
vector. From here, SAS writes the values to a SAS data set 
as a single observation. 
Along with data set variables and computed variables, the 
PDV contains two automatic variables, _N_ and _ERROR_. The 
_N_ variable counts the number of times the DATA step 
begins to iterate. The _ERROR_ variable signals the 
occurrence of an error caused by the data during execution. 
The value of _ERROR_ is either 0 (indicating no errors 
exist), or 1 (indicating that one or more errors have 
occurred). SAS does not write these variables to the output 
data set.
 
0
Raj
 
 
Question
How would you code a merge that will write the matches of
both to one data set, the non-matches from the left-most
data set to a second data set, and the non-matches of the
right-most data set to a third data set.
Rank Answer Posted By  
 Question Submitted By :: Jaipal Reddy
This Interview Question Asked @   Accenture
I also faced this Question!!   © ALL Interview .com
Answer
this problem over come by using the joins statements
 
0
Giri
 
 
Answer
data new1 new2 new3;
merge old1 (in=one) old2 (in=two);
if one and two then output new1;
else if one and not two then output new2;
else output new3;
run;
 
0
Tangyoulei
 
 
Answer
data one;
input ID$ NAME$;
datalines;
A01 SUE
A02 TOM 
A05 KAY
A10 JIM
;
RUN;
DATA TWO;
INPUT ID$ AGE SEX$;
DATALINES;
A01 58 F
A02 20 M
A04 47 F
A10 11 M
;
RUN;

DATA N1 N2 N3;
MERGE ONE (IN=X) TWO (IN=Y);
BY ID;
IF X=1 AND Y=1 THEN OUTPUT N1;
IF X=1 AND Y=0 THEN OUTPUT N2;
IF X=0 AND Y=1 THEN OUTPUT N3;
RUN;
 
5
Arun & G.n.rao
 
 
Answer
proc sql;

create table both_match as
select *
from one
intersect
select *
from two;

create table left_non as
select *
from one
except
select *
from two;

create table right_non as
select *
from two
except
select *
from one;

quit;
 
0
Vinod Swarna
 
 
Answer
The above proc sql is not working. it is throwing up error.

Please verify. If anybody give proc sql code for the above 
question that would be great.

padma
 
0
Padma
 
 
Answer
what is the error u r getting ?
 
0
Vinod
 
 
Question
How would you code a merge that will keep only the
observations that have matches from both sets.
Rank Answer Posted By  
 Question Submitted By :: Jaipal Reddy
This Interview Question Asked @   Accenture
I also faced this Question!!   © ALL Interview .com
Answer
Using "IN" variable option. Look at the following example.

data  three;
merge one(in=x) two(in=y);
by id; 
if x=1 and y=1;
run;
 
0
Nishant
 
 
Answer
data  three;
merge one(in=x) two(in=y);
by id; 
if x and y;
run;
 
0
Pallavi
 
 
Answer
Using joins in proc sql statement, see following example

proc sql;
select *
from a, b
where a.case_id = b.case_id;
quit;
 
0
Sheetal
 
 
Answer
proc sort data=one;
by id;
run;
proc sort data=two;
by id;
run;
data comm_rec;
merge one(in=a) two(in=b);
by id;
if a and b;
run;
proc print data=comm_rec;
run;
 
0
Madhavi
 
 
Answer
here we used simple answer ia
data merge;
merge(tables------);
by (same colum);
if e1 and e2 then
output;
keep-----;
run;
 
0
Kamudu
 
 
Question
How would you delete observations with duplicate keys?
Rank Answer Posted By  
 Question Submitted By :: Jaipal Reddy
This Interview Question Asked @   Accenture
I also faced this Question!!   © ALL Interview .com
Answer
using nodupkey
 
0
Satish
 
 
Answer
Use nodupkey option in proc sort
 
0
Nishant
 
 
Answer
or distinct in proc sql
 
0
Tangyoulei
 
 
Answer
using Nodup you can delete duplicate observation
 
0
Chirag Patel
 
 
Answer
use nodupkey in proc sort automatically the duplicate key 
going to delete.
 
0
Ganesh
 
 
Answer
There is stage called Remove Duplicate to delete duplicate 
record and also Sort stage do same funtion.Otherwise if 
source databse is a table,then in source SQL we can select 
distinct value.
 
0
Roopanwita
 
 
Answer
we can delete the observation by using NODUP.

proc sort data=name nodup;
by varname;
run;
 
0
Ganesh
 
 
Answer
In data step first dot variable and last dot variable use 
to delete the duplicate values.
 by using no dup  we delete the duplicate values in row wise
and no dup key is used to delete the duplicate values in 
column wise it means observation
and distinct is use to delete the duplicate values in proc 
sql
 
0
Haritha
 
 
Answer
nodupkey
 
0
Prakash
 
 
Answer
proc sort data= nodupkeys;
by variable;
run;
 
0
Serena
 
 
Question
How would you delete duplicate observations?
Rank Answer Posted By  
 Question Submitted By :: Jaipal Reddy
This Interview Question Asked @   Accenture , Accenture
I also faced this Question!!   © ALL Interview .com
Answer
we can delete duplicate observations by using nodup or
nodupkey option in the proc sort 

Example :-

Proc sort data=datasetname nodup;
run;
 
0
Poornima
 
 
Answer
use nodupkey, noduprec in sort processure
 
0
Soniya
 
 
Answer
noduprecs
 
0
Saritha
 
 
Answer
noduprecs
 
0
Saritha
 
 
Answer
by using merge statement
 
0
Vijay
 
 
Answer
using proc sort and by statements
 
0
Raj
 
 
Answer
There are several ways to do this. However the easliest 
code-wise is to use PROC SORT. For example: 

PROC SORT DATA=mydata NODUPKEY;
BY variable;
RUN;
 
0
Vijay
 
 
Answer
there 3 options to delete duplicate obs
1. nodup
2. nodupkey
3.noduprec

if a entire record is duplicated in sense we use nodup of 
nodup rec in proc sort procedure.
proc sort data=dsn nodup/noduprec;
by var;
run;


if a variable is repeated not a entire record . this time 
we use nodupkey

proc sort data=dsn nodupkey;
by var;
run;

ex; in a dataset empid is repeated then use this syn. and 
the empid is used in by var statement.
 
0
Srinivas
 
 
Question
Code a PROC SORT on a data set containing State, District
and County as the primary variables, along with several
numeric variables.
Rank Answer Posted By  
 Question Submitted By :: Jaipal Reddy
This Interview Question Asked @   Accenture
I also faced this Question!!   © ALL Interview .com
Answer
data daya;
infile 'c:\country.txt';
input &state  &district &country population total:
proc sort data=daya:
by state;
proc print data=daya;
run;
 
0
Daya
 
 
Answer
data abc;
infile 'c:\country.txt';
input &state  &district &country population total:
proc sort data=abc:
by state district country;
proc print data=abc;
run;
 
0
Pallavi
 
 
Answer
data info;
infile 'C:\country.txt';
input $state $district $country population total;
proc sort data=info;
by state district country;
proc print data= info ;
 run;
 
2
Prakash
 
 
Answer
data code;
infile'C:\Documents and Settings\admin\Desktop\country.txt';
input state$ district$ county$ population total;
proc sort data=code out=count;
by state district county;
run;
proc print data=count;
run;
 
0
Chiranjeevi
 
 
Answer
here some step has syntax errors lik in input statement its 
mentioned as $ state and so but correct form is state $...
 
0
Radhika Rakesh
 
 
 
Back to Questions Page