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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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