Building models with SAS Enterprise Miner, SAS Factory Miner, SAS Visual Data Mining and Machine Learning or just with programming

Find variable names that are in one dataset but not in another

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 82
Accepted Solution

Find variable names that are in one dataset but not in another

If I have 2 data sets:

data investment;  

   begin='01JAN1990'd;

   end='31DEC2009'd;

  run;    

data investment_2;  

   begin='01JAN1990'd;

     run; 

I wish to write a program that will give me list of all columns that are in investment but not in investment_2. So in this case, the variable 'end'.

How to do this? I dont want to list out the column names using proc contents on eaqch dataset and then manually eyeball it and check for differences.


Accepted Solutions
Solution
‎01-05-2015 12:18 PM
Respected Advisor
Posts: 3,777

Re: Find variable names that are in one dataset but not in another

proc compare base=investment(obs=0) compare=investment_2(obs=0) listbase;
  
run;

View solution in original post


All Replies
Solution
‎01-05-2015 12:18 PM
Respected Advisor
Posts: 3,777

Re: Find variable names that are in one dataset but not in another

proc compare base=investment(obs=0) compare=investment_2(obs=0) listbase;
  
run;
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 272 views
  • 0 likes
  • 2 in conversation