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

Explain the message 'Merge has one or more datasets with repeats of by variables'.

5 Answers  


Explain data_null_?

0 Answers  


what are the softwares and applications that are used most frequently used by sas bi applications developers? : Sas-bi

0 Answers  


when we are using the PROC TRANSPOSE? OBSERVATIONS are repeated then what will happen and what it will show in log window.

1 Answers  


how can u convert this 25-jul-2010 from numeric to charcter?

3 Answers  


The Lion King is hosting an animal conference. All the animals in the world attend except one. Which animal does not attend?

6 Answers   Oracle,


How you can read the variables that you need?

0 Answers  


what is the difference between compiler and interpreter? give any one example (software product) that act as a interpreter?

36 Answers   Accenture, College School Exams Tests, CTS, IBM, IHRD, Infosys, Sylhet Engineering College, TCS, Wipro,


"What is the difference between proc sort nodup and proc sort nodupkey?"

2 Answers  


explain the main difference between the nodup and nodupkey options? : Sas-administrator

0 Answers  


What is the difference between %local and %global?

1 Answers  


Code a PROC SORT on a data set containing State, District and County as the primary variables, along with several numeric variables.

7 Answers   Accenture,


Categories