| Date: | Tue, 18 Oct 2011 17:38:08 -0400 |
| Reply-To: | David Friedman <harrypotterdhf@EARTHLINK.NET> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | David Friedman <harrypotterdhf@EARTHLINK.NET> |
| Subject: | Concatenating Fields Separated by "and" and ","'s |
|---|
Hi, I am trying to concatenate 4 variables into one field separated by
"and", if two non-blank fields, and ","'s and "and", if more than two
non-blank fields. How can I obtain the desired output? Thanks!
Sample Input:
id var1 var2 var3 var4
1 test1 exam2
2 test3 test4 test5
Desired Output
1 test1 and exam2
2 test3, test4, and test5
|