Ask Your Question
0

How is incrementing done in SAS proc sql?

asked 2022-09-04 11:00:00 +0000

huitzilopochtli gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-03-17 20:00:00 +0000

qstack gravatar image

In SAS proc sql, incrementing can be done using the following ways:

  1. Using the "INTO" clause to increment a variable value:
proc sql;
    select max(id)+1 into :new_id from my_table;
quit;
  1. Using the "CALCULATED" keyword to increment a computed column value:
proc sql;
    select id, calculated id+1 as new_id
    from my_table;
quit;
  1. Using the "DATA" step to create a new variable and assign it an incremented value:
data my_table;
    set my_table;
    new_id = id + 1;
run;

Note: The above examples assume the variable being incremented is called "id".

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-09-04 11:00:00 +0000

Seen: 8 times

Last updated: Mar 17 '22