SAS 変数定義 dataステップ
SASの変数定義についてのメモ
変数の型や変数長、フォーマット等を指定できる
SQLプロシジャなどでも変数の型や変数長、フォーマット等を指定できるが、ここではdataステップでの方法を紹介する
attribステートメント
length,label,formatなどを同時に指定可能
data xxx;
attrib
変数1 length = $10 label = "aaaaa"
変数2 length = $20 label = "bbbbb"
変数3 length = 8
変数4 length = 8 format = time5.
変数5 length = 8 label = "eeeee" format = yymmdd10.
;
...
run;
などと指定
lengthステートメント
文字数値の設定や長さの設定するだけなら、こっちの方が楽
data xxx;
length 変数1 8 変数2 $50;
...
run;
で、変数1は数値変数、変数2は長さ20の文字変数
arrayステートメント
配列定義のときに、新規変数を定義可能
data xxx;
array AAA[10] $1111 VAR1 - VAR10;
...
run;
など
変数の順番だけ変えたいときは
data xxx;
format 変数1 変数2 ...;
set xxx;
run;
data xxx;
format 変数1 変数2 ...;
set xxx;
run;
https://support.sas.com/documentation/cdl_alternate/ja/lestmtsref/68024/HTML/default/n1wxb7p9jkxycin16lz2db7idbnt.htm
https://support.sas.com/documentation/cdl_alternate/ja/lestmtsref/68024/HTML/default/p08do6szetrxe2n136ush727sbuo.htm
Author And Source
この問題について(SAS 変数定義 dataステップ), 我々は、より多くの情報をここで見つけました https://qiita.com/saspy/items/932910021b25e4627aa1著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .