BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
knighsson
Obsidian | Level 7

Hello 

 

I want to combine the same date together and calculate how many days, could you please let me know how to do this?

The original dataset

ID DATE XX YY
1 04/10/13    
1 04/10/13  

 

1 05/10/13    
1 06/10/13    
2 04/10/13    
2 04/10/13    
2 04/10/13    
       
       
       

the ideal dataset

ID DATE number of same date YY
1 04/10/13  2  
1 05/10/13 1

 

1 06/10/13 1  
2 04/10/13 3  
       
       
       
       
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Use PROC FREQ, result will be in the WANT data set. 

 

proc freq data=have noprint;
table id*date / out=want list;
run;

@knighsson wrote:

Hello 

 

I want to combine the same date together and calculate how many days, could you please let me know how to do this?

The original dataset

ID DATE XX YY
1 04/10/13    
1 04/10/13  

 

1 05/10/13    
1 06/10/13    
2 04/10/13    
2 04/10/13    
2 04/10/13    
       
       
       

the ideal dataset

ID DATE number of same date YY
1 04/10/13  2  
1 05/10/13 1

 

1 06/10/13 1  
2 04/10/13 3  
       
       
       
       

 

View solution in original post

2 REPLIES 2
Reeza
Super User

Use PROC FREQ, result will be in the WANT data set. 

 

proc freq data=have noprint;
table id*date / out=want list;
run;

@knighsson wrote:

Hello 

 

I want to combine the same date together and calculate how many days, could you please let me know how to do this?

The original dataset

ID DATE XX YY
1 04/10/13    
1 04/10/13  

 

1 05/10/13    
1 06/10/13    
2 04/10/13    
2 04/10/13    
2 04/10/13    
       
       
       

the ideal dataset

ID DATE number of same date YY
1 04/10/13  2  
1 05/10/13 1

 

1 06/10/13 1  
2 04/10/13 3  
       
       
       
       

 

knighsson
Obsidian | Level 7
Thank you!