What is LAG function?How is it used? can any one explain
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
what are all the default values getting in PROC MEANS...???
How would you keep from overlaying the a SAS set with its sorted version?
what are sas bi dashboard components? : Sas-bi
what are the methods that you would employ to fine tune your SQL extract process using SAS/Access or Proc SQL?
how would you create a data set with 1 observation and 30 variables from a data set with 30 observations and 1 variable? : Sas programming
Explain the difference between nodup and nodupkey options?
We want to merge file A and B. File A has variable age, file B provide birthdate. How to merge the data according to age in file B
Explain data step in SAS
Can we create datasets by proc step ? (Proc contents, Means)?
Give some examples where proc report’s defaults are same as proc print’s defaults?
explain the difference between alternate key, business key, foreign key, generated key, primary key, retained key and surrogate key ? : Sas-di
what is option year cuttoff in sas