[sas-users] Comparing the actual dataset layout to the prescribed dataset layout
david.d.chapman at census.gov
david.d.chapman at census.gov
Thu Aug 25 14:13:16 EDT 2011
If layout of the SAS dataset spec layout was the same as a proc contents,
you could consider using proc compare. I use this all the time compare to
different datasets.
Christianna Williams has presented a paper both at SGF and NESUG on PROC
COMPARE. You can probably find the paper on Lex Jensen's web site.
It all depends on making the spec_layout SAS dataset resemble a proc
contents SAS dataset.
David D. Chapman
Chief, Quality Assurance Staff
Economic Planning and Coordination Division
U.S. Census Bureau - Economic Statistics
Office: 301-763-6535
Cell: 703-498-5782
E-mail: david.d.chapman at census.gov
Connect with us:
From:
richard.lee at census.gov
To:
sas-users at lists.census.gov
Date:
08/25/2011 02:08 PM
Subject:
Re: [sas-users] Comparing the actual dataset layout to the prescribed
dataset layout
Sent by:
sas-users-bounces at lists.census.gov
I don't know how to make your program more efficient, but I find your
program quite useful.
Thanks!
-----sas-users-bounces at lists.census.gov wrote: -----
To: sas-users at lists.census.gov
From: josue.delarosa at census.gov
Sent by: sas-users-bounces at lists.census.gov
Date: 08/25/2011 01:44PM
Subject: [sas-users] Comparing the actual dataset layout to the prescribed
dataset layout
When verifying files I used to print out a proc contents report and
compare it to the layout of a file which was prescribed in a
specification. Instead of reviewing the variables by pencil and paper
I’ve been experimenting with the following program. Any feedback on how
to make this program more efficient would be appreciated.
Thanks,
Josh
*output contents to dataset;
proc contents data=dataset NODETAILS out=contents;
run;
*keep only var names;
data contents2 (keep=name);
set contents;
run;
*import layout of file from specification, assumes layout is already in
excel form;
PROC IMPORT OUT=spec_layout
DATAFILE= "C:\...\spec.xls"
DBMS=EXCEL REPLACE;
RANGE="Sheet1$";
GETNAMES=YES;
MIXED=NO;
SCANTEXT=YES;
USEDATE=YES;
SCANTIME=YES;
RUN;
proc sort data=spec_layout;
by name;
run;
*merge files and look for vars in layout and not in dataset & vice versa;
data not_in_spec not_in_contents ;
merge spec_layout (in=s) contents2 (in=c);
by name;
if s=1 and c=0 then output not_in_contents;
else if s=0 and c=1 then output not_in_spec;
run;
_______________________________________________
sas-users mailing list
sas-users at lists.census.gov
http://lists.census.gov/mailman/listinfo/sas-users
_______________________________________________
sas-users mailing list
sas-users at lists.census.gov
http://lists.census.gov/mailman/listinfo/sas-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.census.gov/pipermail/sas-users/attachments/20110825/1aad3b1e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 4056 bytes
Desc: not available
URL: <http://lists.census.gov/pipermail/sas-users/attachments/20110825/1aad3b1e/attachment-0001.jpe>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 660 bytes
Desc: not available
URL: <http://lists.census.gov/pipermail/sas-users/attachments/20110825/1aad3b1e/attachment-0004.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 646 bytes
Desc: not available
URL: <http://lists.census.gov/pipermail/sas-users/attachments/20110825/1aad3b1e/attachment-0005.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 1177 bytes
Desc: not available
URL: <http://lists.census.gov/pipermail/sas-users/attachments/20110825/1aad3b1e/attachment-0006.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 654 bytes
Desc: not available
URL: <http://lists.census.gov/pipermail/sas-users/attachments/20110825/1aad3b1e/attachment-0007.gif>
More information about the sas-users
mailing list