【問題】1つのデータセットを2つに分割
/*testデータ*/
data test ;
no=1 ; flg=. ; output ;
no=2 ; flg=1 ; output ;
no=3 ; flg=. ; output ;
run ;
no | fig |
---|---|
1 | . |
2 | 1 |
3 | . |
/*(1)flg^=1の場合はaに出力、flg=1の場合はbに出力する*/
data a b ;
set test ;
if flg^=1 then output a ;
else if flg=1 then output b ;
run ;
no | fig |
---|---|
1 | . |
3 | . |
no | fig |
---|---|
2 | 1 |
/*(2)全てのOBSをaに出力、flg=1の場合はbに出力する*/
data a b ;
set test ;
output a ;
if flg=1 then output b ;
run ;
no | fig |
---|---|
1 | . |
2 | 1 |
3 | . |
no | fig |
---|---|
2 | 1 |