BookmarkSubscribeRSS Feed
By_Reddy
Calcite | Level 5

Hi,

I have a Question any one can help me please

I have two libraries

       A) OLD       (oracle)

       B) NEW     (other)

In OLD library i have some 20 datasets...

In NEW library also has same amount of datasets...

Now my task is

In NEW library all datasets will update the data everyday....so i need a code should compare with OLD library datasets....

The macro code should test all --------> The dataset is there or not in library, dataset name, veriable names same or any change, char, numaric, length,....and obs should > 0,....then the code will run to other sas file which has in other location....If any of it worng should get a message where the worng!

Thanks,

Reddy

3 REPLIES 3
LarryWorley
Fluorite | Level 6

Hi Reddy,

An approach to this might be to use the SAS SQL dictionary tables or sashelp views.  to do these comparisons..  You can find several references to these by searching for  " dictionary views site:support.sas.com"  For SAS 9.2, these are documented at http://support.sas.com/documentation/cdl/en/sqlproc/62086/HTML/default/viewer.htm#a001385596.htm

You can use proc compare and the dictionary.tables or sashelp.vtable to check most table/dataset info.  Note, you won't be able to directly check obs for database tables.  So you may need to build a macro or call execute data step which you feed a list of datasets/tables from these views.

You can use proc compare and the dictionary.columns or sashelp.vcolumn to compare column attributes by table/dataset.

For the oracle libname, you will need to make sure tables/views you are using are visible through the libname statment.  You may need 'show-synonyms=yes' if you are accessing synonyms/

Happy coding.

Larry

By_Reddy
Calcite | Level 5

Thanks Larry.

But here we need to use only macro code no other PROC's

Regards,

Reddy

LarryWorley
Fluorite | Level 6

Reddy,

Regardless of how you implement the comparisons, these views/tables give you access into metadata about the tables.    You can implement the harvesting of this information into macro variables by using either data step or proc sql code to move the data into macro variables for use by your macros.

Larry

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 547 views
  • 4 likes
  • 2 in conversation