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

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

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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