- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I need to copy some datsets from path1 to path1/backup. Then I need to copy some datasets from path2 to path1.
But before doing that, I would like to compare the variables (only the variables not their values, and variables atttributes) in each dataset.
I have tried
proc compare base=FTEDATA.Agent compare=FTESGOT. Agent novalues;
run;
But It still see values comparison.
what's the best options ?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You can set obs=0 for both datasets, i.e.:
proc compare base=FTEDATA.Agent (obs=0) compare=FTESGOT.Agent (obs=0) listvars;
run;
Compare will throw a warning, but it still compares the metadata.
Another option is to use PROC CONTENTS to output variable metadata as data, and then you can use PROC COMPARE on the datasets. e.g.
data have ;
set sashelp.class (drop=weight);
run ;
proc contents data=sashelp.class out=class_vars (keep=name type length label /* etc */ );
run ;
proc contents data=have out=have_vars (keep=name type length label /* etc */ ) ;
run ;
proc compare base=class_vars compare=have_vars error listobs;
id name ;
run ;
Next up: SAS Trivia Quiz hosted by SAS on Wednesday May 21.
Register now at https://www.basug.org/events.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You can set obs=0 for both datasets, i.e.:
proc compare base=FTEDATA.Agent (obs=0) compare=FTESGOT.Agent (obs=0) listvars;
run;
Compare will throw a warning, but it still compares the metadata.
Another option is to use PROC CONTENTS to output variable metadata as data, and then you can use PROC COMPARE on the datasets. e.g.
data have ;
set sashelp.class (drop=weight);
run ;
proc contents data=sashelp.class out=class_vars (keep=name type length label /* etc */ );
run ;
proc contents data=have out=have_vars (keep=name type length label /* etc */ ) ;
run ;
proc compare base=class_vars compare=have_vars error listobs;
id name ;
run ;
Next up: SAS Trivia Quiz hosted by SAS on Wednesday May 21.
Register now at https://www.basug.org/events.