如何在SAS中编写ods乳胶模板
根据本文件: 我创建了附加的结果并使用附加的代码 但我希望生成自己的模板,创建如下输出(具有多行和部分网格的表): 有人知道如何做到这一点吗?或者是学习编写ods模板中使用的语言的好来源。非常感谢如何在SAS中编写ods乳胶模板,sas,latex,ods,Sas,Latex,Ods,根据本文件: 我创建了附加的结果并使用附加的代码 但我希望生成自己的模板,创建如下输出(具有多行和部分网格的表): 有人知道如何做到这一点吗?或者是学习编写ods模板中使用的语言的好来源。非常感谢 ods path(prepend) work.templat(update); proc template; define tagset Tagsets.event1; define event colspec_entry; put just "|" /if ^cmp( just, "d
ods path(prepend) work.templat(update);
proc template;
define tagset Tagsets.event1;
define event colspec_entry;
put just "|" /if ^cmp( just, "d");
put "r|" /if cmp( just, "d");
end;
define event table;
start:
put NL;
put NL;
put "\begin{longtable}";
finish:
put "\hline \end{longtable}" NL;
put NL;
end;
define event stacked_cell;
start:
put NL;
put "\begin{tabular}";
trigger alignment;
finish:
put "\end{tabular}" NL;
end;
define event colspecs;
start:
put "{";
finish:
put "}\hline" NL;
end;
define event colspec_entry;
put just /if ^cmp( just, "d");
put "r" /if cmp( just, "d");
end;
define event row;
finish:
put "\\" NL;
end;
define event header;
start:
trigger data;
finish:
trigger data;
end;
define event data;
start:
put VALUE /if cmp( $sascaption, "true");
break /if cmp( $sascaption, "true");
put %nrstr(" & ") /if ^cmp( COLSTART, "1");
put " ";
unset $colspan;
set $colspan colspan;
do /if exists( $colspan) | exists ( $cell_align );
put "\multicolumn{";
put colspan /if $colspan;
put "1" /if ^$colspan;
put "}{";
put "|" /if ^$instacked;
put just;
put "|" /if ^$instacked;
put "}{";
done;
put tranwrd(VALUE,"-","$-$") /if contains( HTMLCLASS, "data");
put VALUE /if ^contains( HTMLCLASS, "data");
finish:
break /if cmp( $sascaption, "true");
put "}" /if exists( $colspan) | exists ( $cell_align );
end;
define event rowspanfillsep;
put %nrstr(" & ");
end;
define event rowspancolspanfill;
put " ~";
end;
define event image;
put "\includegraphics{";
put BASENAME /if ^exists( NOBASE);
put URL;
put "}" NL;
end;
parent = tagsets.latex;
end;
run;
data t;
length v1 $20;
input v1 $ v2;
datalines;
f=ma 21
sqrt(abd) 22
;
run;
ods tagsets.simplelatex file="/scratch/columbia/zz89/t1.tex";
proc print data=t;
run;
ods tagsets.simplelatex close;
ods tagsets.event1 file="/scratch/columbia/zz89/t2.tex";
proc print data=t;
run;
ods tagsets.event1 close;
data re1;
infile "/scratch/columbia/zz89/t1.tex" pad missover;
file "/scratch/columbia/zz89/t1_out.tex";
length c1 $200;
input c1 $ 1-200;
p1=index(c1,'sqrt');
if p1>0 then do;
c2=substr(c1,(p1+5));
p2=index(c2,')');
c3=substr(c1,1,(p1-1))||'$\sqrt{'||scan(c2,1,')') ||'}$'||substr(c2,(p2+1));
put c3;
end;
else put c1;
run;
写一个标记集可能是一项令人讨厌的工作,而且不是一种常见的做法。所需的输出看起来像是可以通过
Proc REPORT
实现的——您能为问题添加一些实际数据吗。请参阅@Richard上的“定义标记集语句”文档,这里有一些数据伪造数据;长度类型$6猫$4;填充数据线dlm=','dsd;输入类型$Cat$EWVAL XSVAL;数据线;市场,低,-32.83,15.56市场,2,-3.36,4.82市场,3,12.48,4.51市场,4,31.22,6.81市场,高,97.89,61.57微,低,-34.76,16微,2,-3.6,4.81微,2,-3.6,4.36,4.49微,4,31.29,6.81微,高,104.34,65.95小,低,-29.12,13.49小,2,-3.22,4.84小,3,12.56,4.52小,4,31.31,6.91小,大,低,43.83,-25.21,11.15大,2,-2.9,4.77大,3,12.6,4.5大,4,30.93,6.74大,高,80.46,41.73;运行代码>