Do you know if there is a way to put a return between the notes?
Currently the field is defined as length notes $32767. If the field is defined as that big is there anything bigger? I have no control over the field size i'm just afraid that if they have 4 rows that have almost that many characters what will happen when it tries to concatenate them?
> Do you know if there is a way to put a return between
> the notes?
From the first response modify:
if last.ONum then output;
if last.ONum then do;
output;/* this puts a blank value for the note field, insert appropriate character code if you want an actual return character */
> Currently the field is defined as length notes
> $32767. If the field is defined as that big is there
> anything bigger? I have no control over the field
> size i'm just afraid that if they have 4 rows that
> have almost that many characters what will happen
> when it tries to concatenate them?
No clue but some create use of a FILE statement and PUT with @ and @@ may create a text file without that size limitation.
Note that the Proc Transpose approach as given assumes that you can specify what the maximum number of strings will be (in your example, it was 3, but it may vary from data set to data set). It would be better to switch to using an array to avoid this limitation.
While using the PROC TRANSPOSE approach, precede the PROC execution with a DATA step that counts and increments a variable every "n" times, then you have flexibility controlling the transposed observation range.
Data task; Input ID ONum notes & $ 30.; cards; 11 10001 This is a Test 11 10001 of SAS 11 10002 Today the weather was good 11 10002 Busy Shopping 44 19999 Fishing 55 77777 Working on car 55 77777 Hunting 55 77777 Swimming ; run;
Data task_final; retain id onum ; length new $ 50; do until (last.onum); set task; by onum; new=catx(" ",new,notes); end; Keep ID ONum new; run;