To use this program, follow these steps:
  1. Open a SAS editor window (or another text editor)
  2. COPY the program below and PASTE it into the editor window
  3. Edit the program so that the FILE= specification points to where the data file is stored on your system
  4. Save the modified program file and RUN it using SAS
The program is below this line. If no program is listed, the URL to the EML document may be in error. If the EML file does not include all the information needed, the SAS program will have errors or be incomplete.

* Package ID: knb-lter-vcr.17.3;
* Cataloging System:VCR; 
* Data set title: A study of water quality conditions in the tidal creeks of Northampton County, Vs; 
* Data set creator:  Luis Lagera -  ; 
* Metadata Provider:    - Virginia Coast Reserve Long-Term Ecological Research Project ; 
* Contact: Dr Luis Lagera -    - ; 
* Contact:    - Information manager - Virginia Coast Reserve Long-Term Ecological Research Project   - jporter@lternet.edu; 
        
Title1 ' A study of water quality conditions in the tidal creeks of Northampton County, Vs' ; 
/* You should replace  'PUT-LOCAL-PATH-TO-DATA-FILE-HERE' (below) with the appropriate path;  
    to your data file (e.g., c:\mydata\datafile.txt). If you want to create a permanent SAS dataset, replace the WORK. specification  
    in the DATA statement (and SET statement in section for range checking) with a valid SAS Library reference. */ 
DATA WORK.data1; 
%let _EFIERR_ = 0; /* set the ERROR detection macro variable */ 
infile 'PUT-LOCAL-PATH-TO-DATA-FILE-HERE' 
                TRUNCOVER; 
input                          
                                    @5 DATE  $ 8.     
                                    @15 TIME  $ 5.     
                                    @21 SITEID  $ 3.     
                                    @28 REPC 2.  
                                    @31 NH4     
                                    @38 NO2     
                                    @42 NOX     
                                    @48 TIN     
                                    @56 PO4     
                                    @61 CHLA     
                                    @67 PHAE     
                                    @72 TSSW     
                                    @78 TSSM     
                                    @84 TSSO     
                                    @91 TSSOPER     
                                    @96 BOD5    ; 
if _ERROR_ then call symputx('_EFIERR_',1); /* set ERROR detection macro variable */  
LABEL DATE ='date when measurements were taken-' ; 
LABEL TIME ='time when measurements were taken-' ; 
LABEL SITEID ='site/station when measurements where taken-' ; 
LABEL REPC ='sample replicate number-' ; 
LABEL NH4 ='dissolved ammonium concentration-umoles/lit' ; 
LABEL NO2 ='nitrite concentration-umoles/lit' ; 
LABEL NOX ='nitrite plus nitrate concentration-umoles/lit' ; 
LABEL TIN ='total inorganic nitrogen-umoles/lit' ; 
LABEL PO4 ='dissolved phosphate concentration (orthophosphate)-umoles/lit' ; 
LABEL CHLA ='chllrophyll a concentration-ug/l' ; 
LABEL PHAE ='phaeophytin concentration-ug/l' ; 
LABEL TSSW ='total suspended solids (whole fractions)-mg/l' ; 
LABEL TSSM ='total suspended solids (mineral fraction)-mg/l' ; 
LABEL TSSO ='total suspended solids (organic fraction)-mg/l' ; 
LABEL TSSOPER ='total suspended solids (organic fraction as % of TSSW)-%' ; 
LABEL BOD5 ='biochemical oxygen demand-mg/l' ;
run;
                
                
                
/* The analyses below are basic descriptions of the variables.
   After testing, they should be replaced. */
                
                
PROC FREQ; 
      TABLES  DATE; 
PROC FREQ; 
      TABLES  TIME; 
PROC FREQ; 
      TABLES  SITEID; 
PROC FREQ; 
      TABLES  REPC;  
PROC MEANS; 
        VAR NH4 ;  
PROC MEANS; 
        VAR NO2 ;  
PROC MEANS; 
        VAR NOX ;  
PROC MEANS; 
        VAR TIN ;  
PROC MEANS; 
        VAR PO4 ;  
PROC MEANS; 
        VAR CHLA ;  
PROC MEANS; 
        VAR PHAE ;  
PROC MEANS; 
        VAR TSSW ;  
PROC MEANS; 
        VAR TSSM ;  
PROC MEANS; 
        VAR TSSO ;  
PROC MEANS; 
        VAR TSSOPER ;  
PROC MEANS; 
        VAR BOD5 ; 
RUN;
                 
TITLE2 'Observations with one or more out of range values'; 
DATA bad1;
SET WORK.data1; 
* List cases where data is out of range;
* Note: if no out of range cases are detected, the variable names will be listed, but no actual cases; 
LENGTH BADVARS $ 255; 
IF ((NH4 NE .) AND (NH4 LT 0)) THEN BADVARS=CAT(TRIM(BADVARS),' NH4-min'); 
IF ((NH4 NE .) AND (NH4 GT 100)) THEN BADVARS=CAT(TRIM(BADVARS),' NH4-max'); 
IF ((NO2 NE .) AND (NO2 LT 0)) THEN BADVARS=CAT(TRIM(BADVARS),' NO2-min'); 
IF ((NO2 NE .) AND (NO2 GT 10)) THEN BADVARS=CAT(TRIM(BADVARS),' NO2-max'); 
IF ((NOX NE .) AND (NOX LT 0)) THEN BADVARS=CAT(TRIM(BADVARS),' NOX-min'); 
IF ((NOX NE .) AND (NOX GT 500)) THEN BADVARS=CAT(TRIM(BADVARS),' NOX-max'); 
IF ((TIN NE .) AND (TIN LT 0)) THEN BADVARS=CAT(TRIM(BADVARS),' TIN-min'); 
IF ((TIN NE .) AND (TIN GT 500)) THEN BADVARS=CAT(TRIM(BADVARS),' TIN-max'); 
IF ((PO4 NE .) AND (PO4 LT 0)) THEN BADVARS=CAT(TRIM(BADVARS),' PO4-min'); 
IF ((PO4 NE .) AND (PO4 GT 5)) THEN BADVARS=CAT(TRIM(BADVARS),' PO4-max'); 
IF ((CHLA NE .) AND (CHLA LT 0)) THEN BADVARS=CAT(TRIM(BADVARS),' CHLA-min'); 
IF ((CHLA NE .) AND (CHLA GT 100)) THEN BADVARS=CAT(TRIM(BADVARS),' CHLA-max'); 
IF ((PHAE NE .) AND (PHAE LT 0)) THEN BADVARS=CAT(TRIM(BADVARS),' PHAE-min'); 
IF ((PHAE NE .) AND (PHAE GT 20)) THEN BADVARS=CAT(TRIM(BADVARS),' PHAE-max'); 
IF ((TSSW NE .) AND (TSSW LT 0)) THEN BADVARS=CAT(TRIM(BADVARS),' TSSW-min'); 
IF ((TSSW NE .) AND (TSSW GT 200)) THEN BADVARS=CAT(TRIM(BADVARS),' TSSW-max'); 
IF ((TSSM NE .) AND (TSSM LT 0)) THEN BADVARS=CAT(TRIM(BADVARS),' TSSM-min'); 
IF ((TSSM NE .) AND (TSSM GT 200)) THEN BADVARS=CAT(TRIM(BADVARS),' TSSM-max'); 
IF ((TSSO NE .) AND (TSSO LT 0)) THEN BADVARS=CAT(TRIM(BADVARS),' TSSO-min'); 
IF ((TSSO NE .) AND (TSSO GT 200)) THEN BADVARS=CAT(TRIM(BADVARS),' TSSO-max'); 
IF ((TSSOPER NE .) AND (TSSOPER LT 0)) THEN BADVARS=CAT(TRIM(BADVARS),' TSSOPER-min'); 
IF ((TSSOPER NE .) AND (TSSOPER GT 100)) THEN BADVARS=CAT(TRIM(BADVARS),' TSSOPER-max'); 
IF ((BOD5 NE .) AND (BOD5 LT 0)) THEN BADVARS=CAT(TRIM(BADVARS),' BOD5-min'); 
IF ((BOD5 NE .) AND (BOD5 GT 20)) THEN BADVARS=CAT(TRIM(BADVARS),' BOD5-max'); 
IF (BADVARS NE ''); 
PROC PRINT data=bad1; 
RUN;