sas - How to roll-up a column of data and separate values by a delimiter? -


i need transform output1 output2.

the first column how i'd break roll-ups. second column i'd roll-up. separate roll-up values /.

output1:

data output1;     input id $ app $;     datalines;     id001 app11     id001 app12     id002 app21     id002 app22     id002 app23     id003 app31     id003 app32     id004 app41     ; 

output2:

id001 app11/app12 id002 app21/app22/app23 id003 app31/app32 id004 app41 

many thanks

you can use

proc transpose data=trail1 out=ttrail1(drop=_name_) prefix=col;     var app; id;  run;  %let ncols = 3; *you can vtable  data res(drop=i col1 - col&ncols.);     set ttrail1;     length res $256;      array cols{*} col1 - col&ncols.;      res = col1;     = 2 dim(cols);        if missing(cols(i)) eq 0 res = cats(res,'/',cols(i));     end; run; 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -