SAS: Custom ODS LATEX tagset -
i'm trying customize output sas tagsets.latex, tagsets.simplelatex , tagsets.tablesonlylatex tagsets. have want: data rows, no headers, no other tags @ all.
this output i'm getting:
\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
this output want:
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
this how create sample tagset:
*running creates 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;
this creates sample data:
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';
i'm close solution i've managed cull rest of tags code , format rest of needed. need way of skipping '\tabularnewline' if line empty, example. problem in method of template, think.
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;
i'd appreciate @ all. thanks.
set variable in data event when data exists, check in row event. use $hasdata
here.
so in row:
finish: break /if cmp( $sascaption, "true"); break /if contains( htmlclass, "data"); break /if ^exists($hasdata); put "\tabularnewline" nl /if ^exists( $colspan); unset $hasdata;
and in data:
unset $colspan; set $colspan colspan; set $hasdata '1';
Comments
Post a Comment