admin管理员组文章数量:1305969
If I create a format that includes a long label, it prints just fine. However, if I nest that format within a new format using square brackets, formatted values will be truncated to 40 characters upon printing.
I print this single value table two times, once using a normal format and once using a nested format. In both cases, I expect the formatted value to be the entire English alphabet twice in a row. However, the second time, when I use the nested format, it truncates the printed value to be only 40 characters long.
PROC FORMAT;
VALUE longfmt
1 = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
VALUE nestfmt
1 = [longfmt.];
QUIT;
PROC SQL;
CREATE TABLE tbl (col NUM);
INSERT INTO tbl VALUES (1);
SELECT col FORMAT=longfmt. FROM tbl;
SELECT col FORMAT=nestfmt. FROM tbl;
QUIT;
If I create a format that includes a long label, it prints just fine. However, if I nest that format within a new format using square brackets, formatted values will be truncated to 40 characters upon printing.
I print this single value table two times, once using a normal format and once using a nested format. In both cases, I expect the formatted value to be the entire English alphabet twice in a row. However, the second time, when I use the nested format, it truncates the printed value to be only 40 characters long.
PROC FORMAT;
VALUE longfmt
1 = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
VALUE nestfmt
1 = [longfmt.];
QUIT;
PROC SQL;
CREATE TABLE tbl (col NUM);
INSERT INTO tbl VALUES (1);
SELECT col FORMAT=longfmt. FROM tbl;
SELECT col FORMAT=nestfmt. FROM tbl;
QUIT;
Share
Improve this question
asked Feb 3 at 15:20
NikNik
4954 silver badges8 bronze badges
2
- 3 You did not include any WIDTH value in your format specification. What did you set the DEFAULT width to when you defined the format? – Tom Commented Feb 3 at 15:34
- Thank you! This enriches my understanding of formats. – Nik Commented Feb 3 at 15:58
1 Answer
Reset to default 4Thanks to Tom, I now understand I should have specified the width of the first format when I nested it in the second format. In other words, I changed [longfmt.]
to [longfmt52.]
:
PROC FORMAT;
VALUE longfmt
1 = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
VALUE nestfmt
1 = [longfmt52.];
QUIT;
PROC SQL;
CREATE TABLE tbl (col NUM);
INSERT INTO tbl VALUES (1);
SELECT col FORMAT=longfmt. FROM tbl;
SELECT col FORMAT=nestfmt. FROM tbl;
QUIT;
本文标签: square bracketNested formats in SAS are truncated to 40 characters when printingStack Overflow
版权声明:本文标题:square bracket - Nested formats in SAS are truncated to 40 characters when printing - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741812849a2398901.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论