|
|
|
|
|
|
r******m 发帖数: 369 | 1 data work.test;
first = 'Ipswich,England';
City_country=substr(First,1,7)!!','!!'England';
run;
The length of City_country is
A 6
B 7
C 17
D 25
大案是D,不知道如何得到的? | P****D 发帖数: 11146 | 2 Typo. The length should be 23, just try it in SAS.
See last sentence -
http://support.sas.com/documentation/cdl/en/basess/58133/HTML/d
Understanding Concatenation of Variable Values
SAS enables you to combine character values into longer ones using an
operation known as concatenation. Concatenation combines character values by
placing them one after the other and assigning them to a variable. In SAS
programming, the concatenation operator is a pair of vertical bars (||). If
your keyboard does not have a solid vertical bar, use two broken vertical
bars (¦¦) or two exclamation points (!!). The length of the new
variable is the sum of the lengths of the pieces or number of characters
that is specified in a LENGTH statement for the new variable. | r******m 发帖数: 369 | 3 totally make sense, thanks! | P****D 发帖数: 11146 | 4 Give me Bao Zi, then!!!
【在 r******m 的大作中提到】 : totally make sense, thanks!
| m*********n 发帖数: 119 | 5 data work.test;
first = 'Ipswich,England';
City_country=substr(First,1,7)!!','!!'England';
citylen=length(city_country);
run;
proc print data=test;
run;
------------
Obs first City_country citylen
1 Ipswich,England Ipswich,England 15
不明白为什么你们都说是23,不是15吗?
by
If
new
【在 P****D 的大作中提到】 : Typo. The length should be 23, just try it in SAS. : See last sentence - : http://support.sas.com/documentation/cdl/en/basess/58133/HTML/d : Understanding Concatenation of Variable Values : SAS enables you to combine character values into longer ones using an : operation known as concatenation. Concatenation combines character values by : placing them one after the other and assigning them to a variable. In SAS : programming, the concatenation operator is a pair of vertical bars (||). If : your keyboard does not have a solid vertical bar, use two broken vertical : bars (¦¦) or two exclamation points (!!). The length of the new
| q**********s 发帖数: 7 | 6 length( ) doesn't count trailing blanks.
if you change the length( ) with lengthc
******
a=lengthc(city_country);
put a;
******
results will be 23. |
|
|
|
|
|
|