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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 1 reply
  • 469 views
  • 0 likes
  • 2 in conversation