Desktop productivity for business analysts and programmers

Creating a new variable with the Query Builder

Reply
N/A
Posts: 0

Creating a new variable with the Query Builder

Hi,

I'm trying to create a lagged variable (the difference between two rows) with the query builder... with no success. In SAS, I would use the lag or dif functions, but with EG I get an error message.

Is there a function that would do this in EG? How would you define this variable?

Thanks,
D.
SAS Super FREQ
Posts: 8,719

Re: Creating a new variable with the Query Builder

Hi:
You cannot use the LAG function with PROC SQL: http://support.sas.com/techsup/unotes/SN/014/014659.html
Since the EG query builder is building SQL, that is probably the source of the error message you are getting.

But, you can open a code node and use your DATA step code with the LAG function, per these examples:
http://support.sas.com/ctx/samples/index.jsp?sid=1498&tab=code
http://support.sas.com/ctx/samples/index.jsp?sid=108&tab=code

cynthia
N/A
Posts: 0

Re: Creating a new variable with the Query Builder

Thank you,

It did solve my small problem,

D.
Ask a Question
Discussion stats
  • 2 replies
  • 233 views
  • 0 likes
  • 2 in conversation