01-30-2018 06:58 AM
I have a dataset like this (obviously i have more than 4 rows though),
I want to turn it into
I've tried using a put function but for some reason i end up with
This is still a string, but just each row is now a paragraph instead, with a weird dot to show the row's end. I would like to remove that and just have the content of the variable from each row to concatenate and become one whole string. Also the data is alphanumeric as it wouldve been A-Z1-100.
If anyone has any idea please help.
01-30-2018 07:26 AM
I would use CALL CATS, which appends the second parameter (stripped of blanks) to the first variable:
data want; set have; length longstring $5000; retain longstring; call cats(longstring,string); run;
01-30-2018 07:31 AM
s_lassen has the right approach. To get the first id you can simply set a variable with the value and retain it.
data d; length a 8 b $3; infile cards; input a b $; cards; 1 abc 2 def 3 ghi 4 jkl run; data b; length n1 8 n2 $32760; set d end=eof; retain n1 n2; if _n_ = 1 then n1 = a; call cats(n2,b); keep n1 n2; if eof then output; run;