SAS Enterprise Guide

Desktop productivity for business analysts and programmers
BookmarkSubscribeRSS Feed
Sean_OConnor
Obsidian | Level 7

Hi,

 

I have a numeric column which has all rows equal to 810,225.

 

I would like to create a new column which increments this value by one for each row. So row one would equal 810,225 row 2 would be 810,226, row 3 would be 810,227 and so on.

 

Could anyone provide some advice as the best way to do this?

2 REPLIES 2
sbxkoenk
SAS Super FREQ
data want;
 set have;
 new_value = old_Value + ( _N_ - 1 );
run;

Koen

andreas_lds
Jade | Level 19
data want;
  set have;
  new_num_col = num_col + _n_;
run;

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1706 views
  • 0 likes
  • 3 in conversation