BookmarkSubscribeRSS Feed
sskt
Quartz | Level 8

お世話になります。

SAS→Pythonのpandasの書き換えを行っているのですが、

 

data a;
  set b;
  array xxx(*) x1 - x13;
  do i = 1 to dim(xxx);
    if xxx(i) = 1 then output;
  end;
run;

のように、1行から(条件に当てはまれば)複数行が生成される、というプログラムをSASで書いています。

これをPandasに書き換えるにはどうすればよろしいでしょうか。 

よく伝わらないようでしたら、追記させていただきます。

 

よろしくお願いいたします。

1 REPLY 1
yu_sas
SAS Employee

SASからPandasの書き換えについては以下のリンクに情報があるようです。しかしOUTPUTステートメントに関しての記載はありません。

 

Comparison with SAS

 

Pandasについてあまり詳しくありませんが、複数のデータフレームに分けて作成し結合するような方法なら可能ではないかと思います。あまり回答が付かない場合、PandasやPythonのコミュニティで聞いたほうがいいかもしれません。

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Discussion stats
  • 1 reply
  • 1045 views
  • 1 like
  • 2 in conversation