+ Reply to Thread
Results 1 to 2 of 2

Thread: Creating a counter in PROC SQL

  1. #1
    Points: 5,567, Level: 48
    Level completed: 9%, Points required for next Level: 183

    Location
    Cincinnati, OHIO
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Creating a counter in PROC SQL




    I'm trying to create a counter column in my PROC
    SQL query with the following code:

    ROW_NUMBER OVER(PARTITION BY CKey ORDER BY Date) -1 AS Counter

    Unfortunately, the log generates a syntax error at the ( between the R
    and the P saying "expecting one of the following: ' , ' , JOIN

    What am I missing here? Any assistance would be greatly appreciated.

    Thanks.

  2. #2
    Probably A Mammal
    Points: 30,730, Level: 100
    Level completed: 0%, Points required for next Level: 0
    bryangoodrich's Avatar
    Location
    Sacramento, California, United States
    Posts
    2,561
    Thanks
    398
    Thanked 618 Times in 551 Posts

    Re: Creating a counter in PROC SQL


    PROC SQL doesn't support windowing functions.

    Typically you rank number because you want to filter by something in that ranking. There are SAS methods to replicate that behavior (sort and then filter) as shown here:

    https://stackoverflow.com/questions/...tion-in-oracle
    You should definitely use jQuery. It's really great and does all things.

+ Reply to Thread

           




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts






Advertise on Talk Stats