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.16.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.     
                                    @14 TIME  $ 5.     
                                    @20 SITEID  $ 3.     
                                    @25 SCTT     
                                    @31 SCTSL     
                                    @39 SCTCO     
                                    @48 MERCT     
                                    @54 RSAL     
                                    @58 DOT     
                                    @64 DO     
                                    @71 SCDEP     
                                    @77 WDEP     
                                    @87 WSPD     
                                    @90 WDIR  $ 3.     
                                    @98 AIRT     
                                    @102 CLCOV  $ 3.     
                                    @108 pH    ; 
if _ERROR_ then call symputx('_EFIERR_',1); /* set ERROR detection macro variable */  
IF (SCTT EQ 99) THEN SCTT= . ;  
IF (SCTSL EQ 99) THEN SCTSL= . ;  
IF (SCTCO EQ 99999) THEN SCTCO= . ;  
IF (MERCT EQ 99) THEN MERCT= . ;  
IF (RSAL EQ 99) THEN RSAL= . ;  
IF (DOT EQ 99) THEN DOT= . ;  
IF (DO EQ 99) THEN DO= . ;  
IF (SCDEP EQ 999) THEN SCDEP= . ;  
IF (WSPD EQ 99) THEN WSPD= . ;  
IF (AIRT EQ 99) THEN AIRT= . ;  
IF (pH EQ 99) THEN pH= . ;  
LABEL DATE ='date when meaurements were taken-' ; 
LABEL TIME ='time when measurements were taken-' ; 
LABEL SITEID ='site/station when measurements where taken-' ; 
LABEL SCTT ='water temperature-deg C' ; 
LABEL SCTSL ='salinity (temperature compensated)-per 1000' ; 
LABEL SCTCO ='conductivity of water sample-umhos/cm' ; 
LABEL MERCT ='water temperature-deg C' ; 
LABEL RSAL ='salinity-per 1000' ; 
LABEL DOT ='water temperature-deg C' ; 
LABEL DO ='dissolved oxygen-mg/l' ; 
LABEL SCDEP ='Secchi disk depth-cm' ; 
LABEL WDEP ='WDEP-none' ; 
LABEL WSPD ='estimated wind speed-knots' ; 
LABEL WDIR ='estimated wind direction-' ; 
LABEL AIRT ='air temperature-deg C' ; 
LABEL CLCOV ='cloud cover-' ; 
LABEL pH ='pH of water sample-pH units' ;
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  WDIR; 
PROC FREQ; 
      TABLES  CLCOV;  
PROC MEANS; 
        VAR SCTT ;  
PROC MEANS; 
        VAR SCTSL ;  
PROC MEANS; 
        VAR SCTCO ;  
PROC MEANS; 
        VAR MERCT ;  
PROC MEANS; 
        VAR RSAL ;  
PROC MEANS; 
        VAR DOT ;  
PROC MEANS; 
        VAR DO ;  
PROC MEANS; 
        VAR SCDEP ;  
PROC MEANS; 
        VAR WDEP ;  
PROC MEANS; 
        VAR WSPD ;  
PROC MEANS; 
        VAR AIRT ;  
PROC MEANS; 
        VAR pH ; 
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 ((SCTT NE .) AND (SCTT LT -5)) THEN BADVARS=CAT(TRIM(BADVARS),' SCTT-min'); 
IF ((SCTT NE .) AND (SCTT GT 45)) THEN BADVARS=CAT(TRIM(BADVARS),' SCTT-max'); 
IF ((SCTSL NE .) AND (SCTSL LT 0)) THEN BADVARS=CAT(TRIM(BADVARS),' SCTSL-min'); 
IF ((SCTSL NE .) AND (SCTSL GT 40)) THEN BADVARS=CAT(TRIM(BADVARS),' SCTSL-max'); 
IF ((SCTCO NE .) AND (SCTCO LT 00)) THEN BADVARS=CAT(TRIM(BADVARS),' SCTCO-min'); 
IF ((SCTCO NE .) AND (SCTCO GT 51000)) THEN BADVARS=CAT(TRIM(BADVARS),' SCTCO-max'); 
IF ((MERCT NE .) AND (MERCT LT -5)) THEN BADVARS=CAT(TRIM(BADVARS),' MERCT-min'); 
IF ((MERCT NE .) AND (MERCT GT 45)) THEN BADVARS=CAT(TRIM(BADVARS),' MERCT-max'); 
IF ((RSAL NE .) AND (RSAL LT 0)) THEN BADVARS=CAT(TRIM(BADVARS),' RSAL-min'); 
IF ((RSAL NE .) AND (RSAL GT 45)) THEN BADVARS=CAT(TRIM(BADVARS),' RSAL-max'); 
IF ((DO NE .) AND (DO LT 0)) THEN BADVARS=CAT(TRIM(BADVARS),' DO-min'); 
IF ((DO NE .) AND (DO GT 20)) THEN BADVARS=CAT(TRIM(BADVARS),' DO-max'); 
IF ((SCDEP NE .) AND (SCDEP LT 0)) THEN BADVARS=CAT(TRIM(BADVARS),' SCDEP-min'); 
IF ((SCDEP NE .) AND (SCDEP GT 300)) THEN BADVARS=CAT(TRIM(BADVARS),' SCDEP-max'); 
IF ((WDEP NE .) AND (WDEP LT 0)) THEN BADVARS=CAT(TRIM(BADVARS),' WDEP-min'); 
IF ((WDEP NE .) AND (WDEP GT 10)) THEN BADVARS=CAT(TRIM(BADVARS),' WDEP-max'); 
IF ((WSPD NE .) AND (WSPD LT 0)) THEN BADVARS=CAT(TRIM(BADVARS),' WSPD-min'); 
IF ((WSPD NE .) AND (WSPD GT 40)) THEN BADVARS=CAT(TRIM(BADVARS),' WSPD-max'); 
IF ((AIRT NE .) AND (AIRT LT -5)) THEN BADVARS=CAT(TRIM(BADVARS),' AIRT-min'); 
IF ((AIRT NE .) AND (AIRT GT 37)) THEN BADVARS=CAT(TRIM(BADVARS),' AIRT-max'); 
IF ((pH NE .) AND (pH LT 1)) THEN BADVARS=CAT(TRIM(BADVARS),' pH-min'); 
IF ((pH NE .) AND (pH GT 14)) THEN BADVARS=CAT(TRIM(BADVARS),' pH-max'); 
IF (BADVARS NE ''); 
PROC PRINT data=bad1; 
RUN;