更改 sas 中列的长度格式
change a length format of a column in sas
这是我的代码:
data want ;
input branch_id branch_name $ branch_specification $ bold_type $ bold_score $ ;
DATALINES ;
612 NATANYA masham_atirey masham 1.15
;
run ;
branch_specification 的输出是 masham_a
我想把长度加长。
您可以在您的数据声明下添加一个length
声明。
length branch_specification .;
请记住,长度语句会将您的操纵变量放在数据集的前面。您可以使用 retain
语句更改顺序。
data want ;
retain branch_id branch_name branch_specification;
length branch_specification .;
input branch_id branch_name $ branch_specification $ bold_type $ bold_score $ ;
DATALINES ;
612 NATANYA masham_atirey masham 1.15
;
run ;
您可以使用 .
信息格式输入 branch_specification
,其余部分使用列表输入,例如
data want ;
input branch_id branch_name $ branch_specification :. bold_type $ bold_score $ ;
DATALINES ;
612 NATANYA masham_atirey masham 1.15
;
run ;
这样就不需要单独的长度语句,变量顺序不变
添加 :
修饰符可防止在 branch_specification
长度小于 15 个字符的情况下输入语句读取第一个定界符(默认为 space)到下一个变量。
这是我的代码:
data want ;
input branch_id branch_name $ branch_specification $ bold_type $ bold_score $ ;
DATALINES ;
612 NATANYA masham_atirey masham 1.15
;
run ;
branch_specification 的输出是 masham_a 我想把长度加长。
您可以在您的数据声明下添加一个length
声明。
length branch_specification .;
请记住,长度语句会将您的操纵变量放在数据集的前面。您可以使用 retain
语句更改顺序。
data want ;
retain branch_id branch_name branch_specification;
length branch_specification .;
input branch_id branch_name $ branch_specification $ bold_type $ bold_score $ ;
DATALINES ;
612 NATANYA masham_atirey masham 1.15
;
run ;
您可以使用 .
信息格式输入 branch_specification
,其余部分使用列表输入,例如
data want ;
input branch_id branch_name $ branch_specification :. bold_type $ bold_score $ ;
DATALINES ;
612 NATANYA masham_atirey masham 1.15
;
run ;
这样就不需要单独的长度语句,变量顺序不变
添加 :
修饰符可防止在 branch_specification
长度小于 15 个字符的情况下输入语句读取第一个定界符(默认为 space)到下一个变量。