Posts

Showing posts with the label NOBS

Proc Compare/Dictionary.Coulmns/Dictionary.Tables.: Program used to compare the SAS datasets in two directories

Image
Here is the new Proc compare.sas program, I have developed ....to compare all the datasets in 2 directories(testing and production) at once and to quick check any mismatches. Proc compare only check if there is any mismatches between the datasets in 2 directories. If any, it reports otherwise it will give us a note saying that: Note: No unequal Values were found. All values compared are exactly equal. See the proc compare snap shot: What if any dataset has the length more than 8, and what if any variable length more than 40 and what if the dataset name has more than 8 characters etc... Proc Compare doesn't address this issue. I have developed the following program to address this issue. It’s a mandatory that we need to follow certain requirements when we are preparing for an electronic submission to the FDA. The following are some of the QC checks FDA requirements: 1) The length of a dataset name & variable name shouldn’t be more than 8 characters. 2) The length data set labe...

Finding the number of observations in SAS dataset

There are a number of ways of finding out the number of observations in a SAS data set and, while they are documented in a number of different places, I have decided to collect them together in one place. At the very least, it means that I can find them again. First up is the most basic and least efficient method: read the whole data set and increment a counter a pick up its last value. The END option allows you to find the last value of count without recourse to FIRST.x/LAST.x logic. data _null_ ; set test end=eof; count+1; if eof then call symput( "nobs" ,count); run; The next option is a more succinct SQL variation on the same idea. The colon prefix denotes a macro variable whose value is to be assigned in the SELECT statement; there should be no surprise as to what the COUNT(*) does… proc sql noprint; select count(*) into :nobs from test; quit; Continuing the SQL theme, accessing the dictionary tables is another route to the same end and has the advantage of need...