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 (November 1996, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 8 Nov 1996 12:44:34 -0800
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Bruce Rogers <gxx18300@GGR.CO.UK>
Organization: Medical IR, Glaxo Wellcome
Subject:      Re: Simple concatenation problem - Help required
Comments: To: Richard Paterson <rpaterso@QEDI.QUINTILES.COM>

Richard Paterson wrote: > > Hi folks, > > I am perplexed by a what must surely be a simple problem ! > > I have a dataset with 10 obs and 1 variable. > > I want to create a macro variable with the value of each observation > concatenated together and seperated by a space.


> I thought the following code would work - > > data test; > length all $200; > retain all; > set labels end=eof; > if _n_ = 1 then all=dsid; > else all=all||dsid; > if eof then call symput('var1',all); > run; > > But ALL is blank for all obseravations. > > Please can someone put me out of my misery and explain why the above will > not work !!


The problem is that the variable ALL is padded up to 200 with blank characters. The concatenate will put the value of DSID after the 200 chars, then effectively truncate it!

Here's what you need:

all = trim(left(all)) || ' ' || dsis ;



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