DATA Step, Macro, Functions and more

merge table and start with specific row

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 14
Accepted Solution

merge table and start with specific row

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?


Accepted Solutions
Solution
2 weeks ago
PROC Star
Posts: 551

Re: merge table and start with specific row

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


All Replies
Solution
2 weeks ago
PROC Star
Posts: 551

Re: merge table and start with specific row

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;
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 161 views
  • 4 likes
  • 2 in conversation