Help using Base SAS procedures

Get first service date

Reply
Frequent Contributor
Posts: 80

Get first service date

hi I have a question on a request that came in...

i have a table that has data that looks like this

 

Machine.           Date.           Load.             Differ

a1.                     02/01/16.       160.               140

a1.                     02/06/16.         40.                 120

i need to get the first load 160 and last differ 120  to get % usage 

sometimes the load might be pervious month because they get service monthly so I would need to get load of pervious month 

 

machine.               date.           Load.            Differ

a2                       01/25/16.     160.               80

a2.                       02/06/16.      40.                120

 

 

Super User
Posts: 17,868

Re: Get first service date

1. What do you want as your output?

2. Please post some more data and examples. I have a feeling your situation is a bit more complex and we're missing details.

Frequent Contributor
Posts: 80

Re: Get first service date

Machine. Date. Load. Differ
a1. 02/01/16. 160. 140
a1. 02/08/16. 40. 120

 

out put 

machine.       Date.       Load.    Differ

a1.                2/08/16.      160.      120 

 

the latest date overrides the earliest but I need the load amt of 160 and the latest 120 


i need to get the first load 160 and last differ 120 to get % usage
sometimes the load might be pervious month because they get service monthly so I would need to get load of pervious month

machine. date. Load. Differ
a2 01/25/16. 160. 80
a2. 02/06/16. 40. 100

 

out put
machine. Date. Load. Differ
a1. 2/06/16. 160. 100

Super User
Posts: 10,516

Re: Get first service date

Are the dates SAS date value numerics or character?

Do you have any rules about something like a second load 160 appearing before a 120? Or extremely long gaps between the two, say 3 months?

Frequent Contributor
Posts: 80

Re: Get first service date

[ Edited ]

The date is numerical ....what is happening the machine was max loaded at 160. It was reduced  40 ..... So when I try to get percentage of usage it would show a negative I was advised not to use the load of 40 but previous load which would be 160 so my percentage of usage would not be negative .... For example if load on 01/01/16. On machine S1.   Was max loaded at 160  and only 60was used differ is 100so on 01/08/16 on machine S1 the load is 40 but it's carrying amt of 100from first load     To get usage 100/40 would be in negative if I can use the load on 01/01/16 the load of 160  with 100 +40  140/160 ....

Ask a Question
Discussion stats
  • 4 replies
  • 274 views
  • 0 likes
  • 3 in conversation