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

So far we were able to generate 4 files for our 2017 data using the code I described and no issues with my machine. Yes, it's a mix of char , date and numeric but no pattern.

mkeintz
PROC Star

You are splitting your dataset be columns rather than by rows, possibly because your number of columns is know, but the number of rows is not always known.  If so, you can run this:

 

data step FILE1 FILE2 FILE3 FILE4;
  set MASTERFILE nobs=nrecs;
  if _n_<= nrecs/4 then output file1; else
  if _n_ <=nrecs/2 then output file2; else
  if _n_ <= 3*nrecs/4 then output file3;
  else output file4;
run;

Regardless of the dataset size, this outputs the first 25% to file1, the 2nd 25% to file2, etc.  

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------

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
  • 16 replies
  • 4995 views
  • 6 likes
  • 6 in conversation