Input SAS Data Set for Examples

The examples in this section use a SAS data set named CITY, which contains information about expenditures for a small city. It reports total city expenditures for the years 1980 through 2000 and divides the expenses into two major categories: services and administration.
The following example uses the DATASETS procedure with the NOLIST option to display the CITY data set. The NOLIST option prevents the DATASETS procedure from listing other data sets that are also located in the WORK library:
data city;
   input Year 4. @7 ServicesPolice comma6.
         @15 ServicesFire comma6. @22 ServicesWater_Sewer comma6.
         @30 AdminLabor comma6. @39 AdminSupplies comma6.
         @45 AdminUtilities comma6.;
   ServicesTotal=ServicesPolice+ServicesFire+ServicesWater_Sewer;
   AdminTotal=AdminLabor+AdminSupplies+AdminUtilities;
   Total=ServicesTotal+AdminTotal;
   label               Total='Total Outlays'
               ServicesTotal='Services: Total'
              ServicesPolice='Services: Police'
                ServicesFire='Services: Fire'
         ServicesWater_Sewer='Services: Water & Sewer'
                  AdminTotal='Administration: Total'
                  AdminLabor='Administration: Labor'
               AdminSupplies='Administration: Supplies'
              AdminUtilities='Administration: Utilities';
   datalines;
1993  2,819   1,120    422   391      63     98
1994  2,477   1,160    500   172      47     70
1995  2,028   1,061    510   269      29     79
1996  2,754     893    540   227      21     67
1997  2,195     963    541   214      21     59
1998  1,877     926    535   198      16     80
1999  1,727   1,111    535   213      27     70
2000  1,532   1,220    519   195      11     69
2001  1,448   1,156    577   225      12     58
2002  1,500   1,076    606   235      19     62
2003  1,934     969    646   266      11     63
2004  2,195   1,002    643   256      24     55
2005  2,204     964    692   256      28     70
2006  2,175   1,144    735   241      19     83
2007  2,556   1,341    813   238      25     97
2008  2,026   1,380    868   226      24     97
2009  2,526   1,454    946   317      13     89
2010  2,027   1,486  1,043   226       .     82
2011  2,037   1,667  1,152   244      20     88
2012  2,852   1,834  1,318   270      23     74
2013  2,787   1,701  1,317   307      26     66
;
proc datasets library=work nolist;
   contents data=city;
run;
The following outputs display the contents of the CITY data set, as well as information about the data set.
Display 6.1 Part 1: The Structure of CITY as Shown by PROC DATASETS
Part 1: The Structure of CITY as Shown by PROC DATASETS
Display 6.2 Part 2: The Structure of CITY as Shown by PROC DATASETS
Part 2: The Structure of CITY as Shown by PROC DATASETS
Display 6.3 Part 3: The Structure of CITY as Shown by PROC DATASETS
Part 3: The Structure of CITY as Shown by PROC DATASETS
The following list corresponds to items in the three SAS outputs shown above:
  1. The Observations and the Variables fields in Part 1: The Structure of CITY as Shown by PROC DATASETS identify the number of observations and the number of variables.
  2. The Engine/Host Dependent Information section in Part 2: The Structure of CITY as Shown by PROC DATASETS lists detailed information about the data set. This information is generated by the engine, which is the mechanism for reading from and writing to files.
  3. The Alphabetic List of Variables and Attributes in Part 3: The Structure of CITY as Shown by PROC DATASETS lists the name, type, length, and position of each variable.
  4. The Label in Part 3: The Structure of CITY as Shown by PROC DATASETS lists the format, informat, and label for each variable, if they exist.
Operating Environment Information: The output in the Engine/Host Dependent Information section might differ, depending on your operating environment. For more information, see the SAS documentation for your operating environment.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.205.189