data family;
<input relation $ birthdate : mmddyy8.;>
cards;
son Frank 01/31/89
daughter June 12-25-87
brother Samuel 01/17/51
;
run;
怎样写INPUT才能正确输入数据。注意第二条纪录的两个数据之间有两个空格。作者: shiyiming 时间: 2006-4-17 21:37 标题: RE: 怎样写INPUT才能正确输入数据 data family;
input relation $ name $ birthdate : mmddyy8.;
cards;
son Frank 01/31/89
daughter June 12-25-87
brother Samuel 01/17/51
;
run;
data family;
length relation $20.;
set family;
relation=trim(relation) ||' '|| name;
drop name;
run; <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->作者: shiyiming 时间: 2006-4-18 10:55 标题: 谢谢 不转换, 直接输入怎么做?作者: shiyiming 时间: 2006-4-27 02:15 标题: 输入问题 data family ;
infile cards;
input @;
ln=length(_infile_) - 8;
input relation $varying20. ln birthdate : mmddyy8.;
drop ln;
cards;
son Frank 01/31/89
daughter June 12-25-87
brother Samuel 01/17/51
;
run;作者: shiyiming 时间: 2006-5-10 03:22 标题: use & as a format modifier to read variable contain blan THE EASIEST WAY IS USE "&" TO tell SAS the relation variable contain one or more single blanks.
25 is the maxium length of your "relation" variable, you can change it even larger if you want.
data family;
input relation & $ 25. birthdate : mmddyy8.;
cards;
son Frank 01/31/89
daughter June 12-25-87
brother Samuel 01/17/51
;
run;