title: Rearranging the order of the text in a character string in SAS?
body: <p>I have a data set with a character variable called "name". It contains the full name  of a person like this:
  "firstname middlename lastname".</p>
  
  <p>I want to have the data rearranged so that is becomes:
  "lastname, firstname middlename".</p>
  
  <p>I'm not that hardcore in SAS functions, but I have used some of the few I know.</p>
  
  <p>(My code can be seen below). </p>
  
  <p>In the first try (test2) I don't get the result I want - I get:
  "lastName , firstName middleName" and not
  "lastName, firstName middleName" - my problem is the comma.</p>
  
  <p>So I thought that I would solve my problem by making af new last name variable containing the comma at the end (in test2_new). But I don't get what I want? SAS put three dots at the end, and not a comma?</p>
  
  <p>I hope a person with more SAS skills than me, can answer my question??</p>
  
  <p>Kind Regards
  Maria
  <img src="https://i.stack.imgur.com/XiNCr.png" alt="enter image description here"></p>