BookmarkSubscribeRSS Feed
jeremy4
Quartz | Level 8

Hi, 

 

I have an Excel spreadsheet (titled "Account number query"), who contains a list of approximately 500 account numbers (variable is called "ACCOUNT_NUMBER"). The Excel spreadsheet can be found in the following location for me (if the Excel spreadsheet needs to be imported):

                                                                G:\2. Projects\2020\Account number query.xlsm

 

I have been asked whether these 500 account numbers on the Excel spreadsheet are in the SAS dataset (ac.account_information), which has over a million observations and also contains the same "ACCOUNT_NUMBER" variable.

 

Please can someone help with the code required to answer the following two questions?

 

Question 1

Would it be possible to show which account numbers are in both the Excel spreadsheet (titled "Account number query") and the SAS dataset (ac.account_information), and which account numbers are in the Excel spreadsheet but not the SAS dataset? Does the Excel spreadsheet information have to be imported to create a new SAS dataset, then compare it with the SAS dataset (ac.account_information)?

 

Question 2

Where the "ACCOUNT_NUMBER" is the same in both the Excel spreadsheet and the SAS dataset, would it be possible to merge on just the "DATE_OPEN" and "BALANCE" fields (and not "MONTH_END") from the Excel spreadsheet (see screenshot below) onto the SAS dataset for the matching "ACCOUNT_NUMBER" observations?

 

Information

In the SAS dataset (ac.account_information), the "ACCOUNT_NUMBER" variable is a character type, with a $30. format and informat of $30.

 

A example of the Excel spradsheet (Account number query) is shown below:

Account number query sample.JPG

 

1 REPLY 1
PaigeMiller
Diamond | Level 26

First you import the Excel file into a SAS data set. Then you can use PROC SQL joins to answer both of your questions.

--
Paige Miller

sas-innovate-white.png

🚨 Early Bird Rate Extended!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Lock in the best rate now before the price increases on April 1.

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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