BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
EEEY
Obsidian | Level 7

My post got messy up. I repost it.

 

hI Patrick,

I am sure you are the expert of hash object. Actually my dataset Have2 is even more complicated than I think.
So my datasets are:

data have1;
input empid;
cards;1111
2222
3333
2124
9999;

data have2;
  input mgrid_1 mgrid_2 mgrid_3 mgrid_4 mgrid_5;
cards;
101 1111 1212 2124 14322
201 2211 2222 3434 5656
301 3322 2124 5434 3333
401 3355 1199 55 77
234 2222 2323 2121 55;

I have added the last row into the dataset have2 to show the complexity of my dataset. 🙂
When this look-up process executes, note that value 2222 appeares at two spots in the dataset have2.
One in column mgrid_2  and the other one in column mgrid_3.The result I want to see would be like:

emplid mgrid col
1111   101   1
2222   2211  2
2222   234   1
3333   5434  4
2124   3322  2

The Column col I would like to add into the want dataset is the level of the manager from Have2 dataset.Hope you could help me out again.

Thanks a lot.

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
  • 15 replies
  • 1666 views
  • 2 likes
  • 5 in conversation