Hi All, Please find the below code. DATA clinton_data; INFILE '/folders/myfolders/Module10/clinton.txt' FIRSTOBS= 3 EXPANDTABS; INPUT @7 Day 7-9 Mo $ 10-12 Year 14-17 Approve 24-25 Disapprove 32-33 No_opinion 40-41; Temp_date = catx(" ",Day,Mo,Year); Date = input(temp_date,DATE11.); PUT Date = DATE11.; FORMAT Date MMDDYY10.; DROP Day Mo Year temp_date; RUN; PROC SORT DATA = clinton_data; BY Date; DATA clinton_data1; SET clinton_data; FORMAT date MMDDYY10.; elapsed_time = (Date – (lag(Date))); difference_approval = (Approve – (lag(Approve))); RUN; PROC PRINT DATA = clinton_data1; RUN; PROC CORR DATA = clinton_data1; VAR elapsed_time difference_approval; RUN; PROC CORR DATA = clinton_data1; VAR elapsed_time difference_approval; RUN; PROC CORR DATA = clinton_data1; VAR Approve; WITH elapsed_time; RUN; I'm getting below error. Can anyone please help? 72 elapsed_time = (Date – (lag(Date))); ___ 22 68 73 difference_approval = (Approve – (lag(Approve))); ___ 22 68 ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, (, *, **, +, -, /, <, <=, <>, =, >, ><, >=, AND, EQ, GE, GT, LE, LT, MAX, MIN, NE, NG, NL, OR, [, ^=, {, |, ||, ~=. ERROR 68-185: The function – is unknown, or cannot be accessed. 74 RUN; Any ideas please? I think SAS University edition doesn't support LAG function. But I'm not sure. If so, any thoughts on why I'm getting this error? any alternative thoughts? Thanks a lot in advance 🙂
... View more