What is LAG function?How is it used? can any one explain

Answers were Sorted based on User's Feedback



What is LAG function?How is it used? can any one explain..

Answer / sheetal

lag function is used to look at the previous values as :

lag(<varaiable name>); gives you the the previous value .

Is This Answer Correct ?    15 Yes 2 No

What is LAG function?How is it used? can any one explain..

Answer / basha

hai gajari
this is basha from chennai no phones no mails why? what
happened man?
ok lets see answer

lag function returns value from que
ex:-
data gajari;
input chindhi 8. @@;
datalines;
1 2 3 4 5
;
run;
data rao;
set gajari;
chore=lag(chindhi);
run;

output:-
obs chndhi chore
1 1 .
2 2 1
3 3 2
4 4 3
5 5 4

ok bye
take care
basha
TVS F&S

Is This Answer Correct ?    9 Yes 0 No

What is LAG function?How is it used? can any one explain..

Answer / naveen

this Question was raised by saddi soorath....

lag function enables you to have the previous value.

we have the following data
Name num
Naveen 1
Naveen 2
Basha 1
Basha 2

so in data step
if u give num1 =lag(num) you will have the following result

Name num num1
Naveen 1 .
Naveen 2 1
Basha 1 .
Basha 2 1

Thanks and regards

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More SAS Interview Questions

If you need the value of a variable rather than the variable itself what would you use to load the value to a macro variable? : sas-macro

0 Answers  


what are the considerations when picking a SAS/STAT procedure?

0 Answers   Accenture, Quintiles,


1.we can execute a macro with in a macro,by using call symput and symget can any one give me one example? 2.We can create the macro variables by using %let,%do,macro parameters,INTO clause in proc sql and call symput, can any one give me example to create macro variable with INTO clause and call symput? 3.

1 Answers  


Mention few capabilities of sas framework.

0 Answers  


how to read raw data in sas. Do it manually and throw the programming.

1 Answers   WNS,






How might you use MOD and INT on numeric to mimic SUBSTR on character Strings?

0 Answers  


How to convert a numeric variable to a character variable?

0 Answers  


If you?re not wanting any SAS output from a data step, how would you code the data statement to prevent SAS from producing a set?

1 Answers  


Does SAS ?Translate? (compile) or does it ?Interpret?? Explain.

10 Answers  


what is option year cuttoff in sas

2 Answers   L&T,


Where do the database management systems store data and how do u import them.

2 Answers   L&T,


Which is the best training institute for SAS in hyderabad.

112 Answers   Stansys Software Solutions,


Categories