BookmarkSubscribeRSS Feed
Nidhi_k
Calcite | Level 5

This will show how to Split SAS Output into multiple Sheets of excel. Change data set as per your data set name and break final output in your desired tab. For ex. my final output was 2104183 rows and I did split data in to 6 tabs because Excel tabs has limit of 100,000 rows for each tab. 

 

Split data in to 3 tabs

 

DATA SNF_EXTRACT_1

      SNF_EXTRACT_2

      SNF_EXTRACT_3;

SET work.SNF_EXTRACT_FINAL;

 

 if _n_ < 400001     then output SNF_EXTRACT_1;

   else

      if _n_ < 900001  then output SNF_EXTRACT_2;

        else                output SNF_EXTRACT_3;

 

RUN;

 

Split data in to 4 tabs

DATA PA_DATA_1

      PA_DATA_2

      PA_DATA_3

     PA_DATA_4;

SET work.PA_DATA;

 

     if _n_ < 700001 then output  PA_DATA_1;

else if _n_ < 800001  then output PA_DATA_2;

else if _n_ < 900001  then output PA_DATA_3;

else                       output PA_DATA_4;

                                        RUN;

 

Split data in to 5 tabs

DATA  PA_DATA_1

      PA_DATA_2

      PA_DATA_3

       PA_DATA_4

       PA_DATA_5;

SET work.PA_DATA;

 

     if _n_ < 800001   then output PA_DATA_1;

else if _n_ < 1600001  then output PA_DATA_2;

else if _n_ < 2400001  then output PA_DATA_3;

else if _n_ < 3200001  then output PA_DATA_4;

else                       output  PA_DATA_5;

                                        RUN;

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

Register now

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 15 replies
  • 30973 views
  • 0 likes
  • 13 in conversation