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のコミュニティで聞いたほうがいいかもしれません。

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Discussion stats
  • 1 reply
  • 1086 views
  • 1 like
  • 2 in conversation