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

Ah, this is it! 

Now I should change my question.

How do I assign the 4000-ish SYM_ROOTs dynamically into, say, 40 equal macro variables to use it in WHERE clause?

 

So instead of using 

 

where SYM_ROOT=:'A'

where SYM_ROOT=:'B'

etc

 

which would vary in size, I would like to have equal subset of SYM_ROOT to put it in the WHERE clause of my main analysis code. Each day would be different, so it has to depend on the total number of obs of SYM_ROOT on daily bases.

 

I searched a few postings but mostly they rely on additional group identifiers. In my case there aren't any.

Reeza
Super User

Take the total number of obs, from sashelp.vtable, divide it by 40 and split your dataset into your 40 subsets by the number of records. 

If you need to keep the groups together, then consider seeing if you can tweak a PROC SURVEYSELECT to do it for you.

MadQuant
Obsidian | Level 7
Thanks. I wasn't aware of PROC SURVEYSELECT, but I will look into it.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 17 replies
  • 7479 views
  • 12 likes
  • 6 in conversation