BookmarkSubscribeRSS Feed
deleted_user
Not applicable
input data looks like this
id date counts
10 5/1 10
10 5/2 5
10 5/3 10

data runningtot;
set input end = finished;
totcount + count;
output;
if finished then do;
date = . ;
count = .;
output;
end;
run;
output will look like this:
ID DATE COUNT TOTCOUNT
10 5/1 10 10
10 5/2 5 15
10 5/3 10 25
10 25
1 REPLY 1
Cynthia_sas
Diamond | Level 26
Actually, the data will look like this:
[pre]
Obs id date count totcount
1 10 05/01 10 10
2 10 05/02 5 15
3 10 05/03 10 25
4 10 . . 25
[/pre]
(Note missing values for OBS #4 for the Date var and the COUNT var) -- if you do a proc print on the runningtot table based on the following code:
[pre]
data input;
infile datalines;
input id date : mmddyy8. count;
return;
datalines;
10 5/1/07 10
10 5/2/07 5
10 5/3/07 10
;
run;

data runningtot;
set input end = finished;
totcount + count;
output;
if finished then do;
date = . ;
count = .;
output;
end;
run;

proc print data=runningtot;
format date mmddyy5.;
run;
[/pre]

Not sure what your question was.
cynthia

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1208 views
  • 0 likes
  • 2 in conversation