[sas-users] Comparing the actual dataset layout to the prescribed dataset layout

william.e.zupko.ii at census.gov william.e.zupko.ii at census.gov
Thu Aug 25 14:08:43 EDT 2011


I'd recommend cutting out the second dataset.
proc contents data=dataset NODETAILS out=contents(keep=name);
run;






William 'Gui' Zupko
Survey Analyst, M3
Manufacturers' Shipments, Inventories and Orders Branch
U.S. Census Bureau


Office: 301-763-3446
E-mail: William.e.zupko.ii at census.gov
census.gov


Connect with us:
(Embedded image moved to file: pic07132.gif)Twitter(Embedded image moved to
file: pic27370.gif)Facebook(Embedded image moved to file: pic05438.gif)
YouTube(Embedded image moved to file: pic12345.gif)Flickr


|------------>
| From:      |
|------------>
  >----------------------------------------------------------------------------------------------------------------------------------------|
  |josue.delarosa at census.gov                                                                                                               |
  >----------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| To:        |
|------------>
  >----------------------------------------------------------------------------------------------------------------------------------------|
  |sas-users at lists.census.gov                                                                                                              |
  >----------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Date:      |
|------------>
  >----------------------------------------------------------------------------------------------------------------------------------------|
  |08/25/2011 01:44 PM                                                                                                                     |
  >----------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Subject:   |
|------------>
  >----------------------------------------------------------------------------------------------------------------------------------------|
  |[sas-users] Comparing the actual dataset layout to the prescribed	dataset layout                                                        |
  >----------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Sent by:   |
|------------>
  >----------------------------------------------------------------------------------------------------------------------------------------|
  |sas-users-bounces at lists.census.gov                                                                                                      |
  >----------------------------------------------------------------------------------------------------------------------------------------|





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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic07132.gif
Type: image/gif
Size: 660 bytes
Desc: not available
URL: <http://lists.census.gov/pipermail/sas-users/attachments/20110825/a0a92f07/attachment.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic27370.gif
Type: image/gif
Size: 646 bytes
Desc: not available
URL: <http://lists.census.gov/pipermail/sas-users/attachments/20110825/a0a92f07/attachment-0001.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic05438.gif
Type: image/gif
Size: 1177 bytes
Desc: not available
URL: <http://lists.census.gov/pipermail/sas-users/attachments/20110825/a0a92f07/attachment-0002.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic12345.gif
Type: image/gif
Size: 654 bytes
Desc: not available
URL: <http://lists.census.gov/pipermail/sas-users/attachments/20110825/a0a92f07/attachment-0003.gif>


More information about the sas-users mailing list