4
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?

日付の列から年/月/日の列を作成する(SPSS Modeler データ加工逆引き1-1)

Last updated at Posted at 2022-07-01

日付の列から年/月/日の列を作成(年月日を分解する)

スクリーンショット 2022-06-14 17.43.54.png

1.想定される利用目的

年や月や日で集計する際のキーとなるフィールド(列)を作成する

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

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

スクリーンショット 2022-06-09 12.56.01.png

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

②[フィールド作成]ノードで以下のように日付関数を利用します。
スクリーンショット 2022-06-09 12.59.16.png

式ビルダーの日付関数を利用すると便利です。
スクリーンショット 2022-06-09 13.10.54.png

③日付から[月]を取り出す関数は datetime_month(日付) です。

④日付から[日]を取り出す関数は datetime_day(日付) です。

⑤分解した要素を再結合する場合は以下の通りです。

スクリーンショット 2022-06-09 12.59.33.png

[デーブル]ノードを実行します。分解と統合が出来ています。
スクリーンショット 2022-06-14 13.31.21.png

注意事項

入力時点でストレージが[日付]で設定してあります。
スクリーンショット 2022-06-09 12.58.54.png

[データ型]タブで日付はカレンダーのアイコン(=日付のストレージとして扱われています)。もしも文字列で日付が読み込まれていた場合には[to_date(フィールド)]関数で日付にストレージを置換しておけば問題なく利用できます。

スクリーンショット 2022-06-09 13.37.51.png

サンプルストリームには日付ストレージを利用せず文字列のまま処理するバージョンも準備しています。
スクリーンショット 2022-06-09 13.55.05.png

4.参考情報

日付や時刻を年,月,日や時,分,秒に分解したい場合

タイムスタンプの年、月、日、時、分、秒の分解 

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

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

4
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
4
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?