1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

文字列から特定文字を除去する(SPSS Modeler データ加工逆引き2-1)

Last updated at Posted at 2022-07-01

文字列から特定文字を除去(文字列置換)

スクリーンショット 2022-06-15 17.44.22.png

この記事は以下のブログをもとに作成されています。詳しく解説されていますのでご覧ください。

1.想定される利用目的

・カンマを含んだ文字列の金額を計算できるようにする
・設備保守記録から特定文字列を利用する際に特殊記号を整える

2.サンプルストリームのダウンロード

3.サンプルストリームの説明

スクリーンショット 2022-06-15 17.44.37.png

a.入力するデータは以下の通りです。
スクリーンショット 2022-06-15 17.55.35.png

b.[フィールド作成]ノードを編集します。「Modelerデータ加工Tips#02」で説明されている通り、カンマ=[","]を文字なし=[""]に置換える[replace(文字列1,文字列2,フィールド)]を利用します。
スクリーンショット 2022-06-15 18.22.33.png

式ビルダーの文字列関数を利用すると簡単に入力できます。
スクリーンショット 2022-06-15 18.24.33.png

c.文字列を計算可能な整数に変換します。関数は[to_integer(フィールド)]です。
スクリーンショット 2022-06-15 17.57.37.png

d.[テーブル]を確認します。
スクリーンショット 2022-06-15 17.57.57.png

e.二つの関数を組み合わせて一度に元フィールドを[置換]ノードで置換えます。
スクリーンショット 2022-06-15 18.25.32.png

f.[テーブル]を確認します。
スクリーンショット 2022-06-15 17.58.43.png

注意事項

CHAR:Character(文字)は、バッククォートで囲む
STRING:Strings(文字列)は、ダブルクォートで囲む

4.参考情報

よく使う「日付と時間」関数

正規表現

SPSS Modeler ノードリファレンス目次

SPSS Modeler 逆引きストリーム集(データ加工)

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?