1
我正在嘗試自定義來自SAS的tagsets.latex,tagsets.simpleLatex和tagsets.tablesOnlyLatex標記集的輸出。我幾乎有我想要的:只有數據行,沒有標題,沒有其他標籤。SAS:自定義ODS LATEX標記集
這是我得到的輸出:
\tabularnewline
\tabularnewline
Internet & 1 & 1 & 150.00 & 150.00 & . & 150.00 & 150.00 \tabularnewline
Mobile & 1 & 1 & 200.00 & 200.00 & . & 200.00 & 200.00 \tabularnewline
Phone & 1 & 1 & 100.00 & 100.00 & . & 100.00 & 100.00 \tabularnewline
這是輸出我想:
Internet & 1 & 1 & 150.00 & 150.00 & . & 150.00 & 150.00 \tabularnewline
Mobile & 1 & 1 & 200.00 & 200.00 & . & 200.00 & 200.00 \tabularnewline
Phone & 1 & 1 & 100.00 & 100.00 & . & 100.00 & 100.00 \tabularnewline
這是如何創建示例標記集:
*Running this creates a new template;
Proc template;
define tagset Tagsets.minimal;
define event byline;end;
define event proc_title;end;
define event note;end;
define event Error;end;
define event Warn;end;
define event Fatal;end;
define event system_footer;end;
define event leaf;end;
define event proc_branch;end;
define event branch;end;
define event pagebreak;end;
define event system_title;end;
define event table;end;
define event table_head;end;
define event colspecs;end;
define event colspec_entry;end;
define event row;
break /if ^contains($HTMLCLASS, "data");
put " " NL " " /if ^exists($colspan);
finish:
break /if cmp($sascaption, "true");
break /if contains(HTMLCLASS, "data");
put "\tabularnewline" NL /if ^exists($colspan);
end;
define event data;
start:
put VALUE /if cmp($sascaption, "true");
break /if cmp($sascaption, "true");
break /if ^contains(HTMLCLASS, "data");
break /if exists($colspan) | exists ($cell_align);
put %nrstr(" & ") /if ^cmp(COLSTART, "1");
unset $colspan;
set $colspan colspan;
put tranwrd(VALUE,"-","$-$") /if contains(HTMLCLASS, "data");
put VALUE /if ^contains(HTMLCLASS, "data");
put " ";
finish:
break /if ^contains(HTMLCLASS, "data");
break /if cmp($sascaption, "true");
break /if exists($colspan) | exists ($cell_align);
end;
parent = tagsets.simplelatex;
end;
quit;
這創建了一些示例數據:
data have;
input stake bet_channel $;
datalines;
150 Internet
200 Mobile
100 Phone
run;
PROC PRINT data=have; RUN;
ods tagsets.minimal file='C:\Temp\betChannel_data.tex' (notop nobot) newfile=table;
proc means data = have N MEAN MEDIAN STDDEV MIN MAX MAXDEC=2;
VAR stake;
label bet_channel = "Channel";
CLASS bet_channel;
run;
ods tagsets.minimal close;
x 'notepad C:\Temp\betChannel_data.tex';
我非常接近解決方案,因爲我已經設法從代碼中挑選所有剩下的標籤,並根據需要對其餘部分進行格式化。例如,如果行是空的,我只需要跳過'\ tabularnewline'的方法。我認爲問題在於模板的這種方法。
define event row;
break /if ^contains($HTMLCLASS, "data");
put " " NL " " /if ^exists($colspan);
finish:
break /if cmp($sascaption, "true");
break /if contains(HTMLCLASS, "data");
put "\tabularnewline" NL /if ^exists($colspan);
end;
我會很感激任何幫助。 謝謝。
偉大的東西。你能否將我引薦到一個文檔中,在那裏我可以看到我可以在這些方法中訪問的所有方法和屬性?我只能在tagsets.latex文件中找到那些文件,例如$ cell_align,&just等。 – user2146441
這只是定義了一個用戶變量,它並沒有真正使用任何內建的東西。您可以查看ODS MARKUP的文檔。不幸的是,那裏真的沒有那麼多。 – Joe