The code you posted doesn't match your data, but I think I know what you were trying to accomplish.
If your actual code was correct, then the following might be what you're seeking.
The reason you got the blank record is because you didn't include an NWAY option on your proc summary statement.
I used the macro you can copy and paste from https://communities.sas.com/t5/SAS-Communities-Library/A-better-way-to-FLIP-i-e-transpose-make-wide-a-dataset/ta-p/433620
I used it because running it replaces everything in your code except for the initial datastep. I added one line to that datastep in order to only keep the numbers from you rank_key field.
Here is the code I ran:
libname project '/folders/myfolders';
DATA PROJECT.IMPORT;
INPUT RANK6_CODE RANK_CODE $ RANK_DESC $ RANK_KEY $;
rank_key=compress(rank_key, , 'kd');
DATALINES;
1 467 Sample_Description0 Rank_1
1 120 Sample_Description1 Rank_2
1 456 Sample_Description2 Rank_3
1 778 Sample_Description3 Rank_4
1 780 Sample_Description4 Rank_5
1 402 Sample_Description5 Rank_6
3 567 Sample_Description0 Rank_1
3 220 Sample_Description1 Rank_2
3 556 Sample_Description2 Rank_3
3 878 Sample_Description3 Rank_4
3 880 Sample_Description4 Rank_5
3 502 Sample_Description5 Rank_6
;
RUN;
%transpose(data=PROJECT.IMPORT, out=PROJECT.outputfile,
by=rank6_code, id=rank_key,sort=yes, descendingid=yes,
delimiter=_, autovars=all)
Art, CEO, AnalystFinder.com
... View more