SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
kmin87
Fluorite | Level 6

I have multiple SAS data bases or libraries consisting of data.

One is titled for example company.teamblue_weekly and company.teamred_weekly. It is social security numbers and relevant columns to that entry. I received a text file of society security.

 

I am trying to find where the social security in which databases listed above so I tried to do this.

filename in ("X:\folder\example.txt");

data test;

input in;

run;

 

proc sort data=in;

by ssn;

run;

 

data teamred teamblue;

merge in (in=a)

company.teamblue_weekly (in=b);

by ssn;

if a then output teamblue;

run;

 

this is what i was trying to do but i am not sure. Would anyone assist?

 

2 REPLIES 2
ballardw
Super User

Are you looking to create a permanent data set that can be used for look-ups? Or is this a one time thing?

Are the data sets in your Company library static or do they change (new files or content of existing files have records appended)?

Do all of your data sets have the same variable name for social security number? The same properties (all numeric or all character with the same defined length)?

 

Since your data set Test does not actually read anything (Input lists variables, not files, the file IN would be on an INFILE statement) your code doesn't do much.

 

SAS does have tools to examine the contents of data sets and find specific variables and properties which is why I ask those questions at the top.

kmin87
Fluorite | Level 6

They have the same variables name and same properties.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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
  • 2 replies
  • 732 views
  • 0 likes
  • 2 in conversation