Sample 25383: Demonstrates Basic Files Generated from ODS MARKUP using CSVALL tagset
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
This sample is from the SAS Sample Library. For additional information refer to "SAS Output Delivery System: User's Guide".
/****************************************************************/
/* S A S S A M P L E L I B R A R Y */
/* */
/* NAME: ODSMRK3 */
/* TITLE: Demonstrates Basic Files Generated from ODS MARKUP */
/* using CSVALL tagset */
/* PRODUCT: BASE */
/* SYSTEM: ALL */
/* KEYS: ODS MARKUP CSVALL */
/* PROCS: PRINT GLM */
/* DATA: */
/* */
/* SUPPORT: UPDATE: */
/* REF: */
/* MISC: */
/* */
/****************************************************************/
options center;
/* Close the listing output. */
ods listing close;
/* Use the CSVALL tagset to create comma separated values. */
/* You can specify the tagset a number of ways. */
/* Here we specify ods markup with the tagset option. */
/* Make sure you close the destination the same way you */
/* opened it. */
ods markup tagset=csvall body='odsmrk3a.csv';
ods markup tagset=csvall close;
/* Specify as tagsets.<tagset_name> */
/* Close it the same way. */
ods tagsets.csvall body='odsmrk3a.csv';
ods tagsets.csvall close;
/* Or simply specify just the tagset name. */
/* Close it the same way. */
ods csvall body='odsmrk3a.csv';
ods csvall close;
/* With CSVALL, you can create a body file. */
/* We will create this file. */
ods csvall body='odsmrk3a.csv';
proc format;
value regfmt 1='East' 2='West' 3='North' 4='South';
value habfmt 1='Urban' 2='Rural' 3='Burbs';
value sexfmt 1='Female' 2='Male';
run;
data one;
retain seed1 543 seed2 1234;
length region habitat sex x w1 y w2 8;
drop ind j;
do region = 1 to 4;
if region eq 2 or region eq 4 then
do habitat = 1 to 2;
do sex = 1 to 2;
call ranuni( seed1, ind );
ind = int( ind * 3 ) + 2;
if region=4 and sex=2 then ind=0;
do j= 1 to ind;
call rannor( seed2, y );
y = int( y * 3 + 13 );
x = 5 * y;
w1 = j;
w2 = 1+mod(j,2);
output;
end;
end;
end;
else
do habitat = 1 to 3;
do sex = 1 to 2;
call ranuni( seed1, ind );
ind = int( ind * 2 ) + 2;
do j= 1 to ind;
call rannor( seed2, y );
y = int( y * 3 + 13 );
x = 5 * y;
w1 = habitat;
w2 = sex;
output;
end;
end;
end;
end;
drop seed1 seed2;
format region regfmt. sex sexfmt. habitat habfmt.;
return;
run;
title2 'Proc print output to CSVALL';
proc print data=one;
where region in (2,4);
format sex 4. region 4.;
run;
data plants;
input type $ @;
do block=1 to 3;
input stemleng @;
output;
end;
cards;
clarion 32.7 32.3 31.5
clinton 32.1 29.7 29.1
knox 35.7 35.9 33.1
o'neill 36.0 34.2 31.2
compost 31.8 28.0 29.2
wabash 38.2 37.8 31.9
webster 32.5 31.1 29.7
;
run;
title2 'Proc GLM output to CSVALL';
proc glm data = plants;
class type block;
model stemleng=type block;
run;
quit;
/* Then close the CSVALL destination the same way it was */
/* opened. */
ods csvall close;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
This example demonstrates using the ODS MARKUP destination with the CSVALL tagset to generate CSV files
| Type: | Sample |
| Topic: | SAS Reference ==> ODS (Output Delivery System)
|
| Date Modified: | 2005-08-10 03:02:32 |
| Date Created: | 2005-05-23 13:50:07 |
Operating System and Release Information
| SAS System | Base SAS | All | 8.2 TS2M0 | n/a |