Sie sind auf Seite 1von 0

SAS-INTERVIEW QUESTIONS

1. What SAS st at ement s woul d you code t o r ead an ext er nal r aw


dat a f i l e t o a DATA st ep?

Ans: I nf i l e and I nput st at ement s ar e used t o r ead
ext er nal r aw dat a f i l e t o a Dat a St ep.

2. How do you r ead i n t he var i abl e t hat you need?

Ans: I f we want t o r ead a par t i cul ar var i abl e i n a
set of SAS dat a set , we can ment i on t he var i abl e
we want i n t he I NPUT st at ement .

3. Ar e you f ami l i ar wi t h speci al i nput del i mi t er s? How ar e
t hey used?

Ans: Yes, we have speci al del i mi t er s l i ke DLM and DSD
i n SAS. Bot h t hese del i mi t er s can be used i n
t he i nf i l e st at ement
The DLM can r ead t he commas and spaces
as dat a del i mi t er s. You may choose any del i mi t er s
you wi sh wi t h t hi s opt i on. You can choose
mul t i pl e char act er such as DLM=XX f or your
del i mi t er .
The DSD opt i on al l ows you t o t r eat t wo
consecut i ve del i mi t er s as cont ai ni ng a mi ssi ng
val ue.

4. I f r eadi ng a var i abl e l engt h f i l e wi t h f i xed i nput , how
woul d you pr event SAS f r omr eadi ng t he next r ecor d i f t he
l ast var i abl e di dn t have a val ue?

Ans: We can use MI SS OVER opt i on i n t he I NFI LE st at ement

5. What i s t he di f f er ence bet ween an i nf or mat and a f or mat ?
Name t hr ee i nf or mat or f or mat ?

Ans: An informat i s an i nst r uct i on t hat SAS uses t o r ead
dat a val ues i nt o a var i abl e
A format i s an i nst r uct i on t hat SAS uses t o wr i t e
dat a val ues

The t hr ee i nf or mat ar e: -
A) Dat e i nf or mat
B) Char act er i nf or mat
c) Numer i c i nf or mat

The t hr ee For mat s ar e: -
A) Dat e f or mat
B) Char act er For mat
C) Numer i c For mat



6. Name and descr i be t hr ee SAS f unct i on t hat u have used, i f
any?
Ans:
A) SUM Function: I t adds t he var i abl e t oget her by
i gnor i ng t he mi ssi ng val ues i f any
E. G: Var =SUM ( var 1, var 2var n) ;
Var 1= SUM ( 1, . , 3) = 4

B) Mean Function: Thi s f unct i on r et ur ns t he ar i t hmet i c
mean ( aver age) and i gnor es t he mi ssi ng val ue.
E. G: Var =MEAN ( var 1, var 2, var 3var n) ;

C) SUBSTR Function: The SUBSTR f unct i on ext r act s a
por t i on of t he char act er dat a val ues based on how
many char act er s ar e desi gnat ed f or r et r i eval .
E. G: Var =SUBSTR ( var , st ar t <, number of char act er s) ;
Var 1=SUBSTR ( ASHOK, 1, 3)
I n t he above exampl e t he SUBSTR f unct i on t akes
St r i ng ASHOK cut s f r omst ar t - poi nt ( 1) t i l l number
of Char act er s ( 3) and st or es ASH i n Var 1


7. How woul d you code t he cr i t er i a t o r est r i ct t he out put
t o be pr oduced?

Ans: ods out put cl ose;


8. What i s t he pur pose of t r ai l i ng@? The @@? How woul d you
use t hem?
Ans: The t r ai l i ng @i s al so known as col umn poi nt er
By usi ng t he t r ai l i ng@, i n t he I NPUT st at ement
gi ves you abi l i t y t o r ead a par t of your r aw dat a
l i ne, t est i t , and t hen deci de how t o r ead
addi t i onal dat a f r omt he same r ecor d.

The si ngl e t r ai l i ng @t el l s t he SAS syst emt o hol d
t he l i ne.

The doubl e Tr ai l i ng @@t el l s t he SAS syst emt o
Hol d t he l i ne mor e st r ongl y.

NOTE : An I NPUT st at ement endi ng wi t h @@i nst r uct s t he pr ogr am
t o r el ease t he cur r ent r aw dat a l i ne onl y when t her e ar e no
dat a val ues l ef t t o be r ead f r omt hat l i ne. The @@, t her ef or e,
hol d t he i nput r ecor d even acr oss mul t i pl e i t er at i on of t he
dat a st ep.

9. Under what ci r cumst ances woul d you code a SELECT const r uct
i nst ead of I F st at ement ?

Ans: Especi al l y i f you ar e r ecodi ng a var i abl e i nt o a
l ar ge number of cat egor i es.

10. What st at ement do you code t o t el l SAS t hat i t i s t o
wr i t e t o an ext er nal f i l e?

Ans: Fi l ename f i l er ef pat h ;
Fi l e f i l er ef ;
Put _al l _ / * wi l l wr i t e al l t he var i abl es. */
Or put t he var i abl es whi ch you r equi r e.

11. I f r eadi ng an ext er nal f i l e t o pr oduce an ext er nal
f i l e, what shor t cut t o wr i t e r ecor d wi t hout codi ng
ever y si ngl e var i abl e on t he r ecor d?

Ans: Put _al l _


12. I f you do not want any SAS out put f r oma dat a st ep, how
woul d you code t he dat a st at ement t o pr event SAS f r om
pr oduci ng a set ?

Ans: By usi ng DATA _NULL_ t he desi r ed out put i s a f i l e
and not a SAS dat aset .

13. What i s t he one st at ement t o set t he cr i t er i a of a dat a
t hat can be coded i n any st ep?

Ans: Opt i ons st at ement


14. Have you ever - l i nked SAS code? I f so, descr i be t he l i ke
and any r equi r ed st at ement used t o ei t her pr ocess t he
code or t he st ep i t sel f .

Ans : The l i nk st at ement t el l s SAS t o j ump i mmedi at el y
To t he st at ement l abel t hat i s i ndi cat ed i n t he
Label st at ement and t o cont i nue execut i ng
st at ement s f r omt hat poi nt unt i l a RETURN
st at ement i s execut ed. The RETURN st at ement
ends pr ogr amcont r ol t o t he st at ement i mmedi at el y
f ol l owi ng t he LI NK st at ement .

Not e: The LI NK st at ement and t he dest i nat i on must
be i n t he same DATA st ep. The dest i nat i on
i s i dent i f i ed by a st at ement l abel i n t he
LI NK st at ement .

15. How woul d you i ncl ude common or r euse code t o be
Pr ocessed al ong wi t h your st at ement ?

Ans: By usi ng %I ncl ude

16. When l ooki ng f or t he dat a cont ai ned i n a char act er
st r i ng of 150 byt es, whi ch f unct i on i s t he best t o
l ocat e t hat dat a: scan, i ndex or i ndexc?

Ans: Scan

17. I f you have a dat a set t hat cont ai ns 100 var i abl es, but
you need onl y f i ve of t hose, what i s t he code t o f or ce
SAS t o use onl y t hose var i abl es?

Ans: Use keep = opt i on;

18. Code a PROC SORT on a dat a set cont ai ni ng st at e,
di st r i ct and count r y as t he pr i mar y var i abl e, al ong
wi t h sever al numer i c var i abl es.

Ans:
PROC SORT dat a- set - name;
BY st at e di st r i ct count r y;
Run;

19. How woul d you del et e dupl i cat e obser vat i on?

Ans: Ther e ar e t hr ee ways t o del et e dupl i cat e
obser vat i ons i n a dat aset

1) Pr oc sor t dat a=SAS- dat a- set nodups;
by var ;
r un;

2) Pr oc sql ;
Cr eat e sas- dat a- set as sel ect * f r om
ol d_sas_dat a_set wher e var =distinct( var ) ;
quit;
3)Data clean;
Set temp;
By group;
If first.group and last.group then
Run;


20. How woul d you code a mer ge t hat wi l l keep onl y t he
obser vat i on t hat have mat ches f or mbot h set s?

Ans: By usi ng t he I N i nt er nal var i abl e i n t he mer ge
st at ement .

DATA NEW;
MERGE ONE_TEMP ( I N=ONE) TWO_TEMP ( I N=TWO) ;
BY NAME;
I F ONE=1 AND TWO=1;
RUN;



21. What i s t he Pr ogr amDat a Vect or ( PDV) ? What ar e t hei r
f unct i ons?

Ans:
Pr ogr amDat a Vect or i s t he t empor ar y hol di ng ar ea.
For exampl e The WHERE st at ement i s may be mor e
ef f i ci ent t hen t he sub set t i ng I f ( especi al l y i f you ar e
t aki ng a ver y smal l sunset f r oma l ar ge f i l e) because i t
checks on t he val i di t y of t he condi t i on t o see i f t he
obser vat i on i s t o be kept or not . Thi s t empor ar y hol di ng
ar ea i s cal l ed t he pr ogr amdat a vect or ( PDV) .

22. Does SAS Tr ansl at e ( compi l e) or does i t I nt er pr et ?
Expl ai n.

Ans: When you submi t a DATA st ep f or execut i on, SAS
checks t he synt ax of t he SAS st at ement s and compi l es
t hem, t hat i s, aut omat i cal l y t r ansl at es t he
st at ement s i nt o machi ne code. I n t hi s phase, SAS
i dent i f i es t he t ype and l engt h of each new var i abl e,
and det er mi nes whet her a t ype conver si on i s
necessar y f or each subsequent r ef er ence t o a
var i abl e.


23. At compi l e t i me when a SAS dat a set i s r ead, what
i t ems ar e cr eat ed?

Ans: At compi l e t i me SAS cr eat es t he f ol l owi ng

A) I nput Buf f er
B) Pr ogr amDat a Vect or ( pdv)
C) Descr i pt or i nf or mat i on


24. Name st at ement s t hat ar e r ecogni zed at compi l e t i me
Onl y?

Ans: Dr op Keep e. t . c


25. I dent i f y st at ement whose pl acement i n t he DATA st ep i s
cr i t i cal

Ans: I nput St at ement .

26. Name st at ement s t hat f unct i on at bot h compi l e and
execut i on t i me.

27. Name st at ement s t hat ar e execut i on onl y.

28. I n t he f l ow of t he DATA st ep pr ocessi ng, what i s t he
f i r st act i on i n a t ypi cal DATA st ep?

Ans: SAS f i r st per f or ms Synt ax check.


29. What i s _n_?

Ans: Thi s i s not hi ng but a i mpl i ci t var i abl e cr eat ed by
SAS dur i ng dat a pr ocessi ng. I t gi ves t he t ot al number
Of r ecor ds SAS has i t er at ed i n a dat aset . I t i s
Avai l abl e onl y f or dat a st ep and not f or pr ocs.

E. G: I f we want t o f i nd ever y t hi r d r ecor d i n a
Dat aset t hen we can use t he _n_ as f ol l ows
Dat a new- sas- dat a- set ;
Set ol d;
I f mod ( _n_, 3) =1 t hen;
Run;

Not e: I f we use a wher e cl ause t o subset t he _n_
Wi l l not yi el d t he r equi r ed r esul t .


BASE SAS:

30. What i s t he ef f ect of t he OPTI ON st at ement ERROR=1?

Ans: I f t he par t i cul ar dat a st ep has one or mor e er r or s
t hen end t he pr ocessi ng


31. What s t he di f f er ence bet ween VAR A1 A4 and VAR A1- - A4?


32. What do t he SAS l og messages numer i c val ues have been
conver t ed t o char act er mean?

Ans: I f we t r y some char act er f unct i on on t he numer i c
val ues t he SAS wi l l aut omat i cal l y conver t t he
numer i c var i abl e i nt o char act er var i abl e.

33. Why i s a STOP st at ement needed f or a POI NT=opt i on on a SET
st at ement ?

Ans: Because POI NT= r eads onl y t he speci f i ed obser vat i ons,
SAS cannot det ect an end- of - f i l e condi t i on as i t woul d i f t he
f i l e wer e bei ng r ead sequent i al l y. Because det ect i ng an end- of -
f i l e condi t i on t er mi nat es a DATA st ep aut omat i cal l y, f ai l ur e t o
subst i t ut e anot her means of t er mi nat i ng t he DATA st ep when you
use POI NT= can cause t he DATA st ep t o go i nt o a cont i nuous
l oop.

NOTE:
You cannot use t he POI NT= opt i on wi t h any of t he
f ol l owi ng:
BY st at ement
WHERE st at ement
WHERE= dat a set opt i on
t r anspor t f or mat dat a set s
sequent i al dat a set s ( on t ape or di sk)
a t abl e f r omanot her vendor ' s r el at i onal dat abase
management syst em.
34. How do you cont r ol t he number of obser vat i on and / or
var i abl e r ead or wr i t e?

Ans: By speci f yi ng obs opt i on

35. Appr oxi mat el y what dat e i s r epr esent ed by t he SAS dat e
val ue of 730?

Ans: 1 J anuar y 1962.

36. How woul d r emove a f or mat t hat has been per manent l y
associ at ed wi t h a var i abl e.

Ans: By Usi ng pr oc dat aset s l i br ar y= somel i br ar y;
Modi f y sasdat aset ;
Run;


37. What does t he RUN st at ement do?

Ans: The r un st at ement execut es t he st at ement .

38. Why SAS consi der ed sel f - document i ng?

Ans: when a sas- dat a- set i s cr eat ed SAS cr eat es t he
Descr i pt or por t i on and t he dat a por t i on of t he
Dat a set . The descr i pt or por t i on cont ai ns t he
Det ai l s l i ke when t he dat aset was cr eat ed, no. of
Obser vat i ons, no. of var i abl es e. t . c. Hence SAS i s
Consi der ed sel f document i ng.


39. Br i ef l y descr i be 5 ways t o do a t abl e l ookup i n SAS.

Ans:

1) Si mpl e t abl e l ookup ( mer gi ng ( mer ge ( i ncl udi ng
I N=OPTI ON) and sub set t i ng I F st at ement )

2) Si mpl e t abl e l ookup ( f or mat s ( PROC FORMAT AND PUT
f unct i on) .

3) Looki ng up wi t h t wo var i abl e ( mer gi ng ( mer ge
( i ncl udi ng I N=OPTI ON) and sub set t i ng I F st at ement )

4) Looki ng up wi t h t wo var i abl e ( ( f or mat s ( PROC
FORMAT, PUT AND I NPUT Funct i on)

5) A t wo- way Looki ng t abl e ( mer ge st at ement usi ng t wo
var i abl es) .



40. What ar e some good SAS pr ogr ammi ng pr act i ces f or
pr ocessi ng var y l ar ge dat a set ?

Ans: For var y l ar ge dat a set wi t h many var i abl es we can
make use of ar r ays i n t he SAS syst er m.


41. How woul d you cr eat e a dat a set wi t h 1 obser vat i on and 30
var i abl es f r oma dat a set wi t h 30 obser vat i ons and 1
Var i abl e?

Ans: Usi ng Pr oc Tr anspose and al so do wi t h t he sas ar r ays.



44. What ar e _numer i c_ and _char act er _ and what do t hey do?

Ans: I f we want t o do a par t i cul ar t ask f or al l t he
numer i c var i abl e we can use t he _numer i c_ and same as
i f we want t o do a par t i cul ar t ask f or al l t he
char act er var i abl e we can use t he _char act er _


46. What i s t he or der of appl i cat i on f or out put dat a set
opt i on, i nput dat a set opt i on and SAS st at ement ?

Ans: I NPUT dat a set opt i on, SAS st at ement opt i on and t hen
OUTPUT opt i on.

47. What i s t he or der of eval uat i on of t he compar i son
oper at or s: + - * / ** ( ) ?


Missing Value:


56. How many mi ssi ng val ues ar e avai l abl e? When mi ght you use
t hem?

Ans: Two mi ssi ng val ues ar e avai l abl e i n SAS, t hey ar e
numer i c and char act er .

57. How do you t est f or mi ssi ng val ues?

Ans: We can t est t he mi ssi ng val ues by usi ng NMI SS
opt i on i n t he i nput st at ement

58. How ar e numer i c and char act er mi ssi ng val ues r epr esent ed
i nt er nal l y?

Ans: The numer i c mi ssi ng val ues r epr esent ed as dot s( . ) and
t he char act er mi ssi ng val ues r epr esent ed as bl ank


FUNCTIONS:

59. What i s t he si gni f i cance of t he OF i n X=SUM ( OF a1- a4,
a6, a9) ; ?

60. What do t he PUT and I NPUT f unct i on do?

Ans: The PUT f unct i on i s used t o i dent i f y t he l ogi c
Pr obl emWhi ch pi ece of code i s execut ed and not
execut ed what t he cur r ent val ue of t he par t i cul ar
var i abl e and what t he cur r ent val ue of t he al l
var i abl e.

I NPUT f unct i on:

The t r adi t i onal use i s t he r er ead a char act er var i abl e wi t h a
numer i c f or mat , execut e a char act er - t o- numer i c conver si on.

The character to numeric conversion function;

I NPUT ( var i abl e, i nf or mat - name)

The I NPUT f unct i on conver t s t he char act er var i abl e t o numer i c

Sal ar y=i nput ( EMP_SALARY, dol l ar 7. ) ;

Char act er val ue Numer i c val ue
EMP_SALARY SALARY
$85, 000 85000

Rename t he assi gni ng variable we cannot have t he same name.

Li ke: EMP_SALARY=i nput ( EMP_SALARY, dol l ar 7. ) ;

The numeric to character conversion function

PUT ( var i abl e, i nf or mat - name) ;

newphone=put ( phone, 7) ;


numer i c val ue char act er val ue
PHONE PHONE
6778000 6778000




61. Whi ch dat e advances a dat e, t i me or dat e/ t i me val ue by a
gi ven i nt er val ?

62. What do t he MOD and I NT f unct i on do?

Ans: MOD f unct i on i s ver y usef ul i f suppose you want t o
sel ect ever y t hi r d obser vat i on f r omSAS dat a set .
Exampl e= dat a t hi r d;
Set ol d;
I f mod( _N_, 3) =1;
Run;

The I NT f unct i on r et unes t he i nt eger por t i on of an
ar gument . To t r uncat e a number ( dr op of f t he
f r act i onal par t ) , you use t he I NT f unct i on.


63. I n ARRAY pr ocessi ng, what does t he DI M f unct i on do?

Ans: DI M i s t he di mensi on f unct i on. Thi s r et ur ns t he
l engt h of t he ar r ay ( i . e. t he number of var i abl e i n
t he l i st ) .

64. How woul d you det er mi ne t he number of mi ssi ng or non-
mi ssi ng val ue i n comput at i on?

Ans: We can use t he N opt i on f or t he number of NON-
MI SSI NG val ues and NMI SS opt i on f or t he number of
MI SSI NG val ues.


65. What i s t he di f f er ence bet ween: X=a+b+c+d; and X=SUM ( a,
b, c, d) ; ?

Ans: I f we use SUM ( a, b, c, d) i t wi l l i gnor e t he mi ssi ng
Val ues i f any and comput e t he sum.

For E. G SUM( 1, . , 2, 3) =6
X=1+. +2+3 = MI SSI NG.


66. Ther e i s a f i el d cont ai ni ng a dat e. I t needs t o be
di spl ayed i n t he f or mat ddmonyy i f i t s bef or e 1975, dd
mon ccyy i f i t s af t er 1985, and as di sco year s i f i t s
bet ween 1975 and 1985. How woul d you accompl i sh t hi s i n
dat a st ep code? Usi ng onl y PROC FORMAT.

67. I n t he f ol l owi ng DATA st ep, what i s needed f or
f r act i on t o pr i nt t o t he l og

Ans:
dat a _nul l _; X=1/ 3;
i f X=. 333 t hen ;
put f r act i on ;
r un;


68. What i s t he di f f er ence bet ween cal cul at i ng t he mean
usi ng t he mean f unct i on and PROC MEANS?

Ans: The mean f unct i on r et ur ns t he mean of t he non- mi ssi ng
val ues i n t he var i abl e l i st . Act ual l y, you may not
have f i gur ed out t he i mpor t ance of t he way t he MEAN
f unct i on deal s wi t h t he mi ssi ng val ues, and t hi s i s
qui t i mpor t ant . i f you cal cul at e SCORE by si mpl y
addi ng up al l t he i t emand di vi di ng by 50 as f ol l ows

SCORE=( i t em1 +i t em2+i t em3+. . +i t em50) / 50;
You woul d be i n bi g t r oubl e i f any of t he i t ems had
mi ssi ng val ues. When SAS st at ement t r i es t o do
ar i t hmet i c oper at i on on mi ssi ng val ues, t he r esul t i s
al ways mi ssi ng.



PROCs:


69. I f you wer e gi ven sever al SAS dat a set s you wer e
unf ami l i ar wi t h, how woul d you f i nd out t he var i abl e names
and f or mat s of each dat aset ?

Ans: I can use t he cont ent s Pr ocedur e of al l i n t he
l i bname and see al l t he var i abl e name and f or mat s of
each dat a set
EG:
PROC CONTENTS DATA=LI BREF. _ALL_;
RUN;


70. How woul d you keep SAS f r omover l ayi ng t he SAS set wi t h
i t s sor t ed ver si on?

Ans: By cr eat i ng a new dat aset af t er sor t i ng by speci f yi ng
Out = new sas dat aset

71. I n PROC PRI NT, can you pr i nt onl y var i abl e t hat begi n wi t h
t he l et t er A

Ans: Yes we can pr i nt var i abl e whi ch begi n wi t h t he l et t er
A by usi ng t he WHERE st at ement i n t he PROC PRI NT
st at ement

WHERE ( VARI ABLE NAME) LI KE A% ;
Or
WHERE ( VARI ABLE NAME =: A ;

72. What ar e some di f f er ences bet ween PROC SUMMARY and PROC
MEANS?

Ans:
1) PROC MEANS pr oduces subgr oup st at i st i cs onl y when a
BY st at ement i s used and t he i nput dat a has been
pr evi ousl y sor t ed ( use PROC SORT) by t he BY
var i abl es. PROC SUMMARY aut omat i cal l y pr oduces
st at i st i cs f or al l subgr oups, gi vi ng you al l t he
i nf or mat i on i n one r un t hat you woul d get by
r epeat edl y sor t i ng a dat a set by t he var i abl es t hat
def i ne each subgr oup and r unni ng PROC MEANS/ .

2) PROC SUMMARY does not pr oduce any i nf or mat i on i n
your out put so you wi l l al ways need t o use t he
OUTPUT st at ement t o cr eat e a new dat a set and use
PROC PRI NT t o see t he comput ed st at i st i cs.




PROC FREQ:


73. Code t he t abl e st at ement f or a si ngl e- l evel ( most common)
f r equency.

Ans
The st at ement f or si ngl e- l evel .

DATA MAR. FREQTEST;
SET BAS. AMPERS;
PROC FREQ DATA =MAR. FREQTEST;
TABLE AGE;
RUN;

74. Code t he t abl e st at ement t o pr oduce a mul t i - l evel
f r equency.

Ans:
The st at ement f or mul t i l evel .

DATA MAR. FREQTEST;
SET BAS. AMPERS;
PROC FREQ DATA =MAR. FREQTEST;
TABLE AGE * gender ;
RUN;


75. Name t he opt i on t o pr oduce a f r equency l i ne i t ems r at her
t hat a t abl e.

76. Pr oduce out put f r oma f r equency. Rest r i ct t he pr i nt i ng of
t he t abl e.




PROC MEANS:

77. Code a PROC MEANS t hat shows bot h summed and aver aged
out put of t he dat a.

78. Code t he opt i on t hat wi l l al l ow MEANS t o i ncl ude mi ssi ng
numer i c dat a t o be i ncl uded i n t he r epor t .

79. Code t he MEANS t o pr oduce out put t o be used l at er .

80. Do you use PROC REPORT or PROC TABULATE? Whi ch do you
pr ef er ? Expl ai n.


MERGING/UPDATING :


81. What happens i n a one- on- one mer ge? When woul d you use
one?

Ans: I f you want t o mer ge t wo dat a set t hat have di f f er ent
var i abl e and onl y one var i abl e as a common var i abl e
wi t h t hat uni que var i abl e we can mer ge t he dat a set
wi t h one- on- one mer ge.

82. How woul d you combi ne 3 or mor e t abl es wi t h di f f er ent
st r uct ur es?

83. What i s t he pr obl emwi t h mer gi ng t wo dat a set t hat have
var i abl e wi t h t he same name but di f f er ent dat a?

Ans: The second dat a set val ue wi l l over wr i t e t he val ue
of t he f i r st dat a set .

84. When woul d you choose t o MERGE t wo dat a set s t oget her and
when woul d you SET t wo dat a set s?

Ans: I f we want t o cr eat e a dat aset as an exact copy of
The ol d dat aset wi t hout any bot her i ng about whi ch
Dat aset i s goi ng t o cont r i but e t o t he new dat aset
Then we wi l l use set st at ement .
I f we want t o cont r ol t he cont r i but i on of t he ol d
Dat aset s t o t he new dat aset t hen we wi l l use t he
Mer ge st at ement

85. Whi ch dat a set i s t he cont r ol l i ng dat a set i n t he MERGE
st at ement ?

Ans: The second f i nal dat aset af t er t he mer ge st at ement .

86. How do t he I N= var i abl e i mpr ove t he capabi l i t y of a
MERGE?

Ans: I N i s a i mpl i ci t var i abl e i n SAS whi ch hel ps i n
cont r ol l i ng whi ch dat aset needs t o cont r i but e t o
t he new dat aset

87. Expl ai n t he message MERGE HAS ONE OR MORE DATASETS WI TH
REPEATS OF BY VARI ABLE .


COSTOMIZED REPORT WRITING:

88. What i s t he pur pose of t he st at ement DATA_NULL_?

Ans:
Use t he keywor d _NULL_, whi ch al l ows t he power of t he
DATA st ep wi t hout cr eat i ng a dat a set .


89. What i s t he pound si gn used f or t he DATA _NULL_?


90. What i s t he pur pose of usi ng t he N=PS opt i on?

Ans: Speci f yi ng N=PS i n t he FI LE st at ement al l ows
t he out put poi nt er t o wr i t e on any l i ne of t he
cur r ent out put



MACRO:

91. What syst emopt i on woul d you use t o hel p debug a macr o?

Ans: Symbol gen Ml ogi c Mpr i nt

92. Descr i be how you woul d cr eat e a macr o var i abl e?

Ans: %l et var =val ue;

93. How do you i dent i f y a macr o var i abl e?

94. How do you def i ne t he end of a macr o?

Ans: %mend

95. How do you assi gn a macr o var i abl e t o a SAS var i abl e?

Ans: Usi ng Cal l Symput



96. what i s t he di f f er ence bet ween %LOCAL and %GLOBAL?

Ans: The %LOCAL t hat var i abl e wi l l be used onl y at t he
par t i cul ar bl ock onl y but i n case of t he %GLOBAL t hat
var i abl e wi l l be used t i l l t he end of t he SAS sessi on

97. How l ong can a macr o var i abl e be? A t oken?

Ans: Ti l l i t passes t o t he wor d scanner .

98. I f you use a SYMPUT i n a DATA st ep, when and wher e can you
use t he macr o var i abl e?

Ans: I t can be used out si de t he scope of dat aset and wi l l
Be gl obal l y avai l abl e.

100. How woul d you code a macr o st at ement t o pr oduce
i nf or mat i on on t he SAS l og?

Ans: %put St at ement

Das könnte Ihnen auch gefallen