BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jopo12345678
Calcite | Level 5

Hello everyone,

I have this table

DATECOUNTCODEGRADESUM
20140144720014476
20140186910028713
20140182890038370
2014014011.
20140122012.
20140181013.
2014011164210111651
2014011936110219420
2014011528410315425
2014019111.
20140159112.
201401141113.

I want this

DATECOUNTCODEGRADESUMSUM2
20140144720014476.
20140186910028713.
20140182890038370.
2014014011.4476
20140122012.8713
20140181013.8370
2014011164210111651.
2014011936110219420.
2014011528410315425.
2014019111.11651
20140159112.19420
201401141113.15425

Basecally I want make another column SUM2 same as SUM but start in row 4.

Is there anybody who can solve my problem?

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

like this?

 

data have;
input DATE:yymmn6. COUNT CO DE GRADE SUM ;
format DATE yymmn6.;
datalines;
201401 4472 0 0 1 4476 
201401 8691 0 0 2 8713 
201401 8289 0 0 3 8370 
201401 4 0 1 1 . 
201401 22 0 1 2 . 
201401 81 0 1 3 . 
201401 11642 1 0 1 11651 
201401 19361 1 0 2 19420 
201401 15284 1 0 3 15425 
201401 9 1 1 1 . 
201401 59 1 1 2 . 
201401 141 1 1 3 . 
;

data want;
	set have;
	SUM2 = lag3(SUM);
run;

View solution in original post

1 REPLY 1
PeterClemmensen
Tourmaline | Level 20

like this?

 

data have;
input DATE:yymmn6. COUNT CO DE GRADE SUM ;
format DATE yymmn6.;
datalines;
201401 4472 0 0 1 4476 
201401 8691 0 0 2 8713 
201401 8289 0 0 3 8370 
201401 4 0 1 1 . 
201401 22 0 1 2 . 
201401 81 0 1 3 . 
201401 11642 1 0 1 11651 
201401 19361 1 0 2 19420 
201401 15284 1 0 3 15425 
201401 9 1 1 1 . 
201401 59 1 1 2 . 
201401 141 1 1 3 . 
;

data want;
	set have;
	SUM2 = lag3(SUM);
run;

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1 reply
  • 867 views
  • 4 likes
  • 2 in conversation