TEMPLATE Procedure: Creating Markup Language Tagsets |
PROC TEMPLATE features: |
SOURCE statement |
DEFINE TAGSET
statement
|
|
This example copies the source for a tagset that SAS
supplies, modifies the template, and then builds a new tagset for custom output.
To create a new tagset, use the SOURCE statement in PROC TEMPLATE to copy
a tagset's source. Then you can customize the template as necessary.
|
proc template;
source tagsets.csv;
run; |
CSV Tagset Source
|
define tagset Tagsets.Csv;
notes 'This is the CSV template';
define event put_value;
put VALUE;
end;
define event put_value_cr;
put VALUE NL;
end;
define event table;
finish:
put NL;
end;
define event row;
finish:
put NL;
end;
define event header;
start:
put ',' /if ^cmp( COLSTART, '1');
put '''';
put VALUE;
finish:
put '''';
end;
define event data;
start:
put ',' /if ^cmp( COLSTART, '1');
put '''';
put VALUE;
finish:
put '''';
end;
define event colspanfill;
put ',';
end;
define event rowspanfill;
put ',' /if ^exists( VALUE);
end;
define event breakline;
put NL;
end;
define event splitline;
put NL;
end;
registered_tm = '(r)';
trademark = '(tm)';
copyright = '(c)';
output_type = 'csv';
stacked_columns = OFF;
end;
| |
|
define tagset Tagsets.mycsv;
notes 'This is the My CSV template';
define event table;
start:
put nl;
finish:
put nl;
end;
define event put_value;
put VALUE;
end;
define event put_value_cr;
put VALUE NL;
end;
define event row;
finish:
put NL;
end;
define event header;
start:
put ',' /if ^cmp( COLSTART, '1');
put '''';
put VALUE;
finish:
put '''';
end;
define event data;
start:
put ',' /if ^cmp( COLSTART, '1');
put '''';
put VALUE;
finish:
put '''';
end;
define event colspanfill;
put ',';
end;
define event rowspanfill;
put ',' /if ^exists( VALUE);
end;
define event breakline;
put NL;
end;
define event splitline;
put NL;
end;
registered_tm = '(r)';
trademark = '(tm)';
copyright = '(c)';
output_type = 'csv';
stacked_columns = OFF;
end; |
Customized CSV Tagsets.mycsv Template Source
|
proc template;
define tagset Tagsets.Mycsv / store = SASUSER.TEMPLAT;
notes 'This is the My CSV template';
define event table;
start:
put NL;
finish:
put NL;
end;
define event put_value;
put VALUE;
end;
define event put_value_cr;
put VALUE NL;
end;
define event row;
finish:
put NL;
end;
define event header;
start:
put ',' /if ^cmp( COLSTART, '1');
put '''';
put VALUE;
finish:
put '''';
end;
define event data;
start:
put ',' /if ^cmp( COLSTART, '1');
put '''';
put VALUE;
finish:
put '''';
end;
define event colspanfill;
put ',';
end;
define event rowspanfill;
put ',' /if ^exists( VALUE);
end;
define event breakline;
put NL;
end;
define event splitline;
put NL;
end;
output_type = 'csv';
copyright = '(c)';
trademark = '(tm)';
registered_tm = '(r)';
stacked_columns = OFF;
end;
run;
| |
Copyright © 2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.