BookmarkSubscribeRSS Feed
Obsidian | Level 7

I have a dataset A that looks like:

Account# Userno
123 1
456 2


I have a dataset B that looks like:



There are thousands of accounts and around 15 users total. Right now I have a datastep where I assign accounts to users in a loop like so:

data example;
set work.A;
p = 1 + mod(_n_-1,nobs);
set work.B point=p nobs=nobs;


What I need is something that does not function with the 'point' function in SAS I think...


I want to add a conditional that would be like this:
data example;
set work.A;
p = 1 + mod(_n_-1,nobs);
set work.B where ((userno in (1,2,3) and flag = 1) OR (userno in (4,5,6) and flag in (1,0)));
point=p nobs=nobs;


As far as I know, you can't add a 'WHERE' when you use the POINT function in the SET option. Does anyone have a recommendation on how to accomplish this another way, or if I'm not being explicit enough, please let me know.



Diamond | Level 26

What is variable FLAG? It's not in your data sets.


It's really hard to generalize from data that has just two observations, but it seems like you just want to do a MERGE with some conditions on variable FLAG (which we know nothing about).


You state you need a loop and POINT=, but I don't see those requirements as necessary or helpful at this time. Instead of requiring certain code to be used (its rarely a good idea to specify that certain code should be used), please explain the problem in more detail, and provide a larger example, I think that will be more helpful.

Paige Miller

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
  • 1 reply
  • 2 in conversation