BookmarkSubscribeRSS Feed
juanvenegas
Fluorite | Level 6

Hi, im new to sas macros. how would I go about creating a macro to do the following: 

 

# Does the comparison table have all columns present in the base dataset?
# Does the comparison table have any columns not present in the base dataset?
# Are corresponding columns between tables of the same data type?
# Are corresponding character columns of the same length?
# Do the tables have the same number of records?

 

any help is appreciated!

3 REPLIES 3
Astounding
PROC Star

Without question, here is the right way to get started.

 

Cut out the macros.

 

Write a program that does all of this for two data sets, hard-coding the data set names.

 

Once you have working code, you can begin to think about how to change that to a macro.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Tip 1, use Base SAS.

Tip 2, use the appropriate procedure:

http://support.sas.com/documentation/cdl/en/proc/65145/HTML/default/viewer.htm#n0c1y14wyd3u7yn1dmfcp...

Proc compare is specifically designed to do these comparisons.

Reeza
Super User
PROC COMPARE will output all of those statistics for you. And most you can capture easily into data sets.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 1114 views
  • 0 likes
  • 4 in conversation