LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 2011, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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


Back to: Top of message | Previous page | Main SAS-L page