每個觀測分布在多行或者一行有多個觀測數(shù)據(jù)的讀取
1、每個觀測分布在多行的數(shù)據(jù)
上期提到列指針用 @40
或者 @'charater'
來定位列。
那么怎么來定位行哪依许?
行指針用 #n
來定位行拥坛,或者用 /
來換行
例:
*創(chuàng)建一個數(shù)據(jù)集highlow;
*使用行指針讀取數(shù)據(jù)文件;
data highlow;
infile 'd:\SAS\lianxi\MyRawData\Temperature.dat';
input city $ state $
/nhigh nlow
#3 rhigh rlow;
run;
proc print;
title 'high and low temprature for july';
run;
本例中可以用#2
代替/
,/
代替#3
2读处、每行有多個觀測
若數(shù)據(jù)每行中不止一個觀測糊治,你可以在input
語句的結尾使用雙@
符號(@@
)。
例:
原始數(shù)據(jù)Precipitation:
nome ak 2.5 15 miami fl 6.75
18 raleigh nc . 12
data rainfall;
infile 'd:\SAS\lianxi\MyRawData\Precipitation.dat';
input city $ state $ nrain mrain @@;
run;
proc print;
title 'n and m rain fall';
run;
參考文獻
The Little SAS Book罚舱,F(xiàn)ifth Edition