02-15-2018 09:49 AM
I need to concatenate two variables.
Example: treatment Dose
Both are characters. I tried to concatenate them using " || ". But Im getting like this : adma;j;j;jkfddddddddddddd
Instead of getting it in one line : adma;j;j;jkfddddddddddddd 30(ml).
Don't know why. Can someone please help with this?
02-15-2018 09:59 AM
Is there a special chaaracter in either of those strings? (Can happen when importing from Excel for instance). Posting test data in the form of a datastep would go a long way to explaining it. Follow this post on how to provide test data:
Currently there is not much to suggest apart from compressing out special characters:
Is one, but there are others.
02-15-2018 10:05 AM
And how do you know. More importantly, how do we know. We cannot see your system, or your data, or in fact what you are doing, or what you are getting out. None of this information has been provided, hence we cannot help. Provide test data in the form of a datastep. Show what you are doing, then show log and output.
02-15-2018 10:26 AM
When you use the || operator unless you specifically trim or strip a variable then the variable is padded to its assigned length.
Please look at the results of this example:
data example; length x $ 25 long y z $ 50; x= 'short'; long= x||' word'; y = strip(x)||' word' ; z = catt(x,' word'); run;
the CATT function (and related CATS) may be better choices than the || operator.
With out showing how you are getting that result it may be that the split line behavior is attempting to show 50 or 60 characters in a table or view that is only 20 or so wide and so the result is wrapping.