format语句-----定义输出格式
基本语法:
format 变量1 格式1 变量2 格式2 ……;
informat语句----定义输入格式
基本语法:
informat 变量1 格式1 变量2 格式2 ……;
data fs;
input x$ y$2.;
x1=x+1;
y1=y+1;
cards;
1100 1100
;
proc print;
run;
输出内容: 数据集中变量属性:
data fs;
format x $2.;
input x$ y$2.;
x1=x+1;
y1=y+1;
cards;
1100 1100
;
proc print;
run;
输出内容: 数据集中变量属性:
data fs;
input x$ y$2.;
format x $2.;
x1=x+1;
y1=y+1;
cards;
1100 1100
;
proc print;
run;
输出内容: 数据集中变量属性:
data fs;
informat x $2.;
input x$ y$2.;
x1=x+1;
y1=y+1;
cards;
1100 1100
;
proc print;
run;
输出内容: 数据集中变量属性:
data fs;
input x$ y$2.;
informat x $2.;
x1=x+1;
y1=y+1;
cards;
1100 1100
;
proc print;
run;
输出内容: 数据集中变量属性:
注意:FORMAT 可以使用在数据步和过程步中,前者把格式永久存储,后者只是临时存储(当前过程中有作用)。
data fs;
input x$ y$2.;
x1=x+1;
y1=y+1;
cards;
1100 1100
;
proc print;
format x $2.;
run;
输出内容: 数据集中变量属性:
关于proc format过程和format语句
proc format:是个过程。目的在于自定义格式。
format:是个语句。目的在于将变量与某种输出格式(自定义和系统格式均可)关联起来。