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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the applications primarily used by business analyst? : Sas-bi

552


what is slowly changing dimension? : Sas-di

624


Is the physical structure of the data set in the same orientation as the report? Do you need to reshape the data sets? What method should you use to reshape the data–DATA steps,PROC TRANSPOSE,output data set from a procedure?

1766


What is the work of tranwrd function?

664


What is the basic structure of a sas program?

596






how we can create a FLAG datasets? Ex:-ID age_group no_persons 1 to 10 10 to 20 3 11 to 20 21 to 30 7 21 to 3o 31 to 40 5

1656


What are the data types does SAS contain?

652


what is factor analysis? : Sas-administrator

609


which date functions advances a date time or date/time value by a given interval? : Sas programming

535


What is auto call macro and how to create a auto call macro? What is the use of it? How to use it in sas with macros? : sas-macro

581


Mention common programming errors committed in sas ?

647


What are the difficulties u faced while doing vital signs table or dataset?

1933


how to create the AE dataset by using SDTMIG specifications and SAP plan by using UNIX platform?

2290


Will it bother you if the guy at the next desk times the frequency and duration of your bathroom or coffee breaks on the grounds that ?you are getting paid twice as much as he is??

2094


What is the difference between using drop = data set option in data statement and set statement?

638