BookmarkSubscribeRSS Feed
Akash_Nupeak
Fluorite | Level 6
If I have data values like
Data ABC;
infile Cards;
Input
Var1 var2;
Cards;
A1 .
A2 0.1
A3 0.1
A4 .
A5 .
B1 0.1
B2 0.1
B3 0.1
B4 .
B5 .
B6 .
B7 0.1
B8 0.1
C1 0.1
C2 0.1
C3 0.1
C4 0.1
C5 .
C6 0.1
D1 .
D2 .
D3 0.1
D4 .
Then need cumulative answer like

Range variable define a range cumulative start from - to end
Cmvt variable for numeric cumulative
mis_cum variable for missing cumulative

range cumtv mis_cum
A0 to A2 . 0.2
A2 to A3 0.2
A3 to A5 . 0.2
B0 to B3 0.5
B3 to B6 . 0.3
B7 to B8 0.2
C0 to C4 0.5
C4 to C5 . 0.1
C5 to C6 0.1
D0 to D2 . 0.2
D2 to D3 0.1 .
D3 to D4 . 0.1


We where adding observation A0,B0
It mean if A1=0.1 it mean A1 is completed
Means A0-A1=0.1
2 REPLIES 2
ballardw
Super User

Your source example data does not include any A0 B0 C0 or D0 values. So where do they come from in the desired output?

 

You need to state your rules more explicitly. I cannot determine how A0 to A2 get 0.2 or A3 to A5 gets 0.2 or B3-B6 gets .03 as a "cumulative value".

Akash_Nupeak
Fluorite | Level 6

@ballardw 

 

We were adding observation A0, B0
It means if A1=0.1 it means A1 is completed
Means  In range A0 to A1=0.1 is completed 

 

we have to first define the A0 or  B0 as an initial start range within the A1 to A4 or B1 to B5 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 2 replies
  • 468 views
  • 0 likes
  • 2 in conversation