BookmarkSubscribeRSS Feed
knveraraju91
Barite | Level 11

Dear,

 

I have a dataset with more than 200 variables. How to find the variables that present in my dataset but in vendor dataset. I checked using proc contents procedure. It is taking time. Is there a quick way to identify. Please help.

 

Thanks

3 REPLIES 3
Reeza
Super User

1. Proc Compare - will print a report. 

2. Use SASHELP.VCOLUMN/Dictionary.Column. These are datasets that contain the variables in each dataset. It's worth learning how to use these well. 

 

Give them a shot and if you need more help post the code you've tried.

Astounding
PROC Star

Don't run a PROC COMPARE on the data sets themselves.  Run it on the output of PROC CONTENTS.  For example:'

 

proc contents data=a noprint out=a_contents;

run;

proc contents data=b noprint out=b_contents;

run;

 

Then run the PROC COMPARE to compare a_contents vs. b_contents.  Use NAME as the BY or ID variable.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Hi,

 

Personally I would be worried about the "200 columns", that is never a good way to work and will cause you problems throughout programming with it.

 

proc sql;
  create table VARS_MISSING as
  select  VNAME
  from    (select * from SASHELP.VCOLUMN where LIBNAME="<your library>" and MEMNAME="<your dataset in upcase>")
  except  (select * from SASHELP.VCOLUMN where LIBNAME="<your library>" and MEMNAME="<your other dataset in upcase>");
quit;
  

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1091 views
  • 12 likes
  • 4 in conversation