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

How would you delete observations with duplicate keys?

13 Answers   Accenture,


You need to perform an analysis on a massive dataset by groups, but are unable to sort the data due to memory constraint. How would you accomplish the task?

2 Answers  


What is shift table? have you ever created shift that?

2 Answers   Accenture, Clinical Research, Quintiles,


In SAS how to read the variable values having different formats. eg:mar99,mar1999 (in a single variable)

8 Answers   GSK GlaxoSmithKline,


How could i automate the code in the scenario:Every month one new data set will be created for that perticular month transaction list.Now i would like to update the data in the source table by appending every month data automatically. jan---set jan; feb---set jan feb; mar---set jan mar;

2 Answers   HSBC,






Explain the special input delimiters used in sas programming.

0 Answers  


how to extract data from SAP servers? Is like oracle servers or any other methods to extract please reply me.

1 Answers  


Baseline definition in your study

3 Answers   Accenture, Quintiles,


Mention the difference between ceil and floor functions in sas?

0 Answers  


What is the difference between %local and %global?

1 Answers  


What is proc sql pass through facility?

4 Answers   L&T,


what is enterprise guide? What is the use of it? : Sas programming

0 Answers  


Categories