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
SAS Super FREQ
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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 844 views
  • 0 likes
  • 2 in conversation