データの分割

「データの分割」の編集履歴(バックアップ)一覧はこちら

データの分割」(2008/10/13 (月) 12:50:30) の最新版変更点

追加された行は緑色になります。

削除された行は赤色になります。

【問題】1つのデータセットを2つに分割 #highlight(sas){ /*testデータ*/ data test ; no=1 ; flg=. ; output ; no=2 ; flg=1 ; output ; no=3 ; flg=. ; output ; run ;} #html2(){{{{{{ <TABLE ALIGN="left" WIDTH="200" HEIGHT="auto" BORDER="1" cellpadding="1" BORDERCOLOR="black"> <CAPTION ALIGN="left">test</CAPTION> <TR BGCOLOR="#ccffff"> <TH>no</TH> <TH>fig</TH> </TR> <TR> <TH>1</TH> <TH>.</TH> </TR> <TR> <TH>2</TH> <TH>1</TH> </TR> <TR> <TH>3</TH> <TH>.</TH> </TR> </TABLE> <br> }}}}}} #highlight(sas){ /*(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 ; } #html2(){{{{{{ <TABLE style="float:left"; WIDTH=200; HEIGHT=auto; BORDER=1; cellpadding=1; BORDERCOLOR=#000000> <CAPTION ALIGN="left">dataA</CAPTION> <TR BGCOLOR="#ccffff"> <TH>no</TH> <TH>fig</TH> </TR> <TR> <TH>1</TH> <TH>.</TH> </TR> <TR> <TH>3</TH> <TH>.</TH> </TR> </TABLE> <TABLE ALIGN="left" WIDTH="200" HEIGHT="auto" BORDER="1" cellpadding="1" BORDERCOLOR="black"> <CAPTION ALIGN="left">dataB</CAPTION> <TR BGCOLOR="#ccffff"> <TH>no</TH> <TH>fig</TH> </TR> <TR> <TH>2</TH> <TH>1</TH> </TR> </TABLE> <br> }}}}}} #highlight(sas){ /*(2)全てのOBSをaに出力、flg=1の場合はbに出力する*/ data a b ; set test ; output a ; if flg=1 then output b ; run ; } #html2(){{{{{{ <TABLE style="float:left"; WIDTH=200; HEIGHT=auto; BORDER=1; cellpadding=1; BORDERCOLOR=#000000> <CAPTION ALIGN="left">dataA</CAPTION> <TR BGCOLOR="#ccffff"> <TH>no</TH> <TH>fig</TH> </TR> <TR> <TH>1</TH> <TH>.</TH> </TR> <TR> <TH>2</TH> <TH>1</TH> </TR> <TR> <TH>3</TH> <TH>.</TH> </TR> </TABLE> <TABLE ALIGN="left" WIDTH="200" HEIGHT="auto" BORDER="1" cellpadding="1" BORDERCOLOR="black"> <CAPTION ALIGN="left">dataB</CAPTION> <TR BGCOLOR="#ccffff"> <TH>no</TH> <TH>fig</TH> </TR> <TR> <TH>1</TH> <TH>.</TH> </TR> </TABLE> <br> }}}}}} #hr(height=1,color=#002bb8)
【問題】1つのデータセットを2つに分割 #highlight(sas){ /*testデータ*/ data test ; no=1 ; flg=. ; output ; no=2 ; flg=1 ; output ; no=3 ; flg=. ; output ; run ;} #html2(){{{{{{ <TABLE ALIGN="left" WIDTH="200" HEIGHT="auto" BORDER="1" cellpadding="1" BORDERCOLOR="black"> <CAPTION ALIGN="left">test</CAPTION> <TR BGCOLOR="#ccffff"> <TH>no</TH> <TH>fig</TH> </TR> <TR> <TH>1</TH> <TH>.</TH> </TR> <TR> <TH>2</TH> <TH>1</TH> </TR> <TR> <TH>3</TH> <TH>.</TH> </TR> </TABLE> <br> }}}}}} #highlight(sas){ /*(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 ; } #html2(){{{{{{ <TABLE style="float:left"; WIDTH=200; HEIGHT=auto; BORDER=1; cellpadding=1; BORDERCOLOR=#000000> <CAPTION ALIGN="left">dataA</CAPTION> <TR BGCOLOR="#ccffff"> <TH>no</TH> <TH>fig</TH> </TR> <TR> <TH>1</TH> <TH>.</TH> </TR> <TR> <TH>3</TH> <TH>.</TH> </TR> </TABLE> <TABLE ALIGN="left" WIDTH="200" HEIGHT="auto" BORDER="1" cellpadding="1" BORDERCOLOR="black"> <CAPTION ALIGN="left">dataB</CAPTION> <TR BGCOLOR="#ccffff"> <TH>no</TH> <TH>fig</TH> </TR> <TR> <TH>2</TH> <TH>1</TH> </TR> </TABLE> <br> }}}}}} #highlight(sas){ /*(2)全てのOBSをaに出力、flg=1の場合はbに出力する*/ data a b ; set test ; output a ; if flg=1 then output b ; run ; } #html2(){{{{{{ <TABLE style="float:left"; WIDTH=200; HEIGHT=auto; BORDER=1; cellpadding=1; BORDERCOLOR=#000000> <CAPTION ALIGN="left">dataA</CAPTION> <TR BGCOLOR="#ccffff"> <TH>no</TH> <TH>fig</TH> </TR> <TR> <TH>1</TH> <TH>.</TH> </TR> <TR> <TH>2</TH> <TH>1</TH> </TR> <TR> <TH>3</TH> <TH>.</TH> </TR> </TABLE> <TABLE ALIGN="left" WIDTH="200" HEIGHT="auto" BORDER="1" cellpadding="1" BORDERCOLOR="black"> <CAPTION ALIGN="left">dataB</CAPTION> <TR BGCOLOR="#ccffff"> <TH>no</TH> <TH>fig</TH> </TR> <TR> <TH>2</TH> <TH>1</TH> </TR> </TABLE> <br> }}}}}} #hr(height=1,color=#002bb8)

表示オプション

横に並べて表示:
変化行の前後のみ表示:
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。