今回はPUTN関数について解説します。
/* putn_point. */
proc format;
value point 1-50='Low'
51-100='High';
run;
data data1;
Id1=putn(1,point.);
run;

- formatプロシージャにより1 – 50 = ‘Low’、51 – 100 = ‘High’とする「point」というルールを設定する。
- putnにより1をpoint.のルールに書き換える。
- putnではpoint.はエラーとなる。
/* putn_"point." */
proc format;
value point 1-50='Low'
51-100='High';
run;
data data1;
Id1=putn(1,"point.");
run;

- formatプロシージャにより1 – 50 = ‘Low’、51 – 100 = ‘High’とする「point」というルールを設定する。
- putnにより1をpoint.のルールに書き換える。
- putnでは”point.”は正常に動く。
/* putn_point */
proc format;
value point 1-50='Low'
51-100='High';
run;
data data1;
Id1=putn(1,point);
run;

- formatプロシージャにより1 – 50 = ‘Low’、51 – 100 = ‘High’とする「point」というルールを設定する。
- putnにより1をpointのルールに書き換える。
- putnではpointは変数として認識されている(?)。
/* putn_"point" */
proc format;
value point 1-50='Low'
51-100='High';
run;
data data1;
Id1=putn(1,"point");
run;

- formatプロシージャにより1 – 50 = ‘Low’、51 – 100 = ‘High’とする「point」というルールを設定する。
- putnにより1をpointのルールに書き換える。
- putnでは”point”は正常に動く。
/* putn_Id1 */
proc format;
value point 1-50='Low'
51-100='High';
run;
data data1;
Id1="point";
output;
run;
data data2; set data1;
Id2=putn(1,Id1);
run;


- formatプロシージャにより1 – 50 = ‘Low’、51 – 100 = ‘High’とする「point」というルールを設定する。
- putnにより1をpointのルールに書き換える。
- putnではId1 = “point”でも正常に動く。
/* putn_Id1,Id2 */
proc format;
value point 1-50='Low'
51-100='High';
run;
data data1;
Id1=1; Id2="point";
output;
run;
data data2; set data1;
Id3=putn(Id1,Id2);
run;


- formatプロシージャにより1 – 50 = ‘Low’、51 – 100 = ‘High’とする「point」というルールを設定する。
- putnにより1をpointのルールに書き換える。
- putnではId1 =1, Id2 = “point”でも正常に動く。
