Chapter Contents

Previous

Next
Using the Output Delivery System in the DATA Step

Example 1: Using the Default Table Definition


ODS features:
FILE statement:
ODS option without suboptions
PRINT fileref
PUT _ODS_

This example uses the DATA step's default table definition to write an output object to the Listing destination.


Program
 Note about code
options pagesize=60 linesize=64 nodate pageno=1;
 Note about code
title 'Leading Grain Producers';
 Note about code
proc format;
   value $cntry 'BRZ'='Brazil'
                'CHN'='China'
                'IND'='India'
                'INS'='Indonesia'
                'USA'='United States';
run;
 Note about code
data _null_;
   length Country $ 3 Type $ 5;
   input Year country $ type $ Kilotons;
   format country $cntry.;
   label type='Grain';
 Note about code
   file print ods;
 Note about code
   put _ods_;
 Note about code
   datalines;
1995 BRZ  Wheat    1516
1995 BRZ  Rice     11236
1995 BRZ  Corn     36276
1995 CHN  Wheat    102207
1995 CHN  Rice     185226
1995 CHN  Corn     112331
1995 IND  Wheat    63007
1995 IND  Rice     122372
1995 IND  Corn     9800
1995 INS  Wheat    .
1995 INS  Rice     49860
1995 INS  Corn     8223
1995 USA  Wheat    59494
1995 USA  Rice     7888
1995 USA  Corn     187300
1996 BRZ  Wheat    3302
1996 BRZ  Rice     10035
1996 BRZ  Corn     31975
1996 CHN  Wheat    109000
1996 CHN  Rice     190100
1996 CHN  Corn     119350
1996 IND  Wheat    62620
1996 IND  Rice     120012
1996 IND  Corn     8660
1996 INS  Wheat    .
1996 INS  Rice     51165
1996 INS  Corn     8925
1996 USA  Wheat    62099
1996 USA  Rice     7771
1996 USA  Corn     236064
;
run;


Listing Output
Listing Output Created with the Default DATA Step Table Definition
 Note about figure
                    Leading Grain Producers                    1
        Country       Grain        Year          Kilotons

     Brazil           Wheat            1995            1516
     Brazil           Rice             1995           11236
     Brazil           Corn             1995           36276
     China            Wheat            1995          102207
     China            Rice             1995          185226
     China            Corn             1995          112331
     India            Wheat            1995           63007
     India            Rice             1995          122372
     India            Corn             1995            9800
     Indonesia        Wheat            1995               .
     Indonesia        Rice             1995           49860
     Indonesia        Corn             1995            8223
     United States    Wheat            1995           59494
     United States    Rice             1995            7888
     United States    Corn             1995          187300
     Brazil           Wheat            1996            3302
     Brazil           Rice             1996           10035
     Brazil           Corn             1996           31975
     China            Wheat            1996          109000
     China            Rice             1996          190100
     China            Corn             1996          119350
     India            Wheat            1996           62620
     India            Rice             1996          120012
     India            Corn             1996            8660
     Indonesia        Wheat            1996               .
     Indonesia        Rice             1996           51165
     Indonesia        Corn             1996            8925
     United States    Wheat            1996           62099
     United States    Rice             1996            7771
     United States    Corn             1996          236064


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.