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

Hello,
I would like to transpose a table.
I only want one the same value in ID.

Thanks a lot for your help.

 

TABLE      
       
IDCODEDATE    
01FAZ5807/01/2020    
01FZE7804/01/2020    
02DS5205/01/2020    
02YU8904/01/2020    
02LM6904/01/2020    
03DS2405/01/2020    
04FS2406/01/2020    
04XC8907/01/2020    
       
WANT:      
       
IDCODE1DATE1CODE2DATE2CODE3DATE3
01FAZ5807/01/2020FZE7804/01/2020  
02DS5205/01/2020YU8904/01/2020LM6904/01/2020
03DS2405/01/2020    
04FS2406/01/2020XC8907/01/2020  
1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20
data have;	 
input ID $	CODE $	DATE	:ddmmyy10.;
format date ddmmyy10.;
cards; 
01	FAZ58	07/01/2020	 	 	 	 
01	FZE78	04/01/2020	 	 	 	 
02	DS52	05/01/2020	 	 	 	 
02	YU89	04/01/2020	 	 	 	 
02	LM69	04/01/2020	 	 	 	 
03	DS24	05/01/2020	 	 	 	 
04	FS24	06/01/2020	 	 	 	 
04	XC89	07/01/2020	 	 	
;

proc sql noprint; 
 select max(obs) into :obs 
from  ( select count(*) as obs from have group by id ) ;
quit;

proc summary nway data=have missing; 
 class id ; 
 output out = want(drop=_type_ _freq_)
 idgroup(out[&obs](code date)=);
run;

View solution in original post

3 REPLIES 3
PeterClemmensen
Tourmaline | Level 20

Why do you want to do this? 🙂

novinosrin
Tourmaline | Level 20
data have;	 
input ID $	CODE $	DATE	:ddmmyy10.;
format date ddmmyy10.;
cards; 
01	FAZ58	07/01/2020	 	 	 	 
01	FZE78	04/01/2020	 	 	 	 
02	DS52	05/01/2020	 	 	 	 
02	YU89	04/01/2020	 	 	 	 
02	LM69	04/01/2020	 	 	 	 
03	DS24	05/01/2020	 	 	 	 
04	FS24	06/01/2020	 	 	 	 
04	XC89	07/01/2020	 	 	
;

proc sql noprint; 
 select max(obs) into :obs 
from  ( select count(*) as obs from have group by id ) ;
quit;

proc summary nway data=have missing; 
 class id ; 
 output out = want(drop=_type_ _freq_)
 idgroup(out[&obs](code date)=);
run;
WilliamB
Obsidian | Level 7
thank you so much

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 3 replies
  • 636 views
  • 0 likes
  • 3 in conversation