BookmarkSubscribeRSS Feed
beekee
Calcite | Level 5

Hi All,

 

I'm new to SAS programming. Want to know how I can split my data into three sub-datasets: data before 1970, data
between 1970 to 1979 and data from 1980 onwards.

 

This is my current dataset:

beekee_0-1629128340917.png

 

This is my current code:

data ANL351.tourism;
infile "/home/u59111097/TMA/tourism.csv" dlm=',' FIRSTOBS = 2;
input year vsp pdi puk exuk pop cpisp exsp;
run;

proc contents data=ANL351.tourism;
run;

proc print data=ANL351.tourism;
run;

 

 

Thank you.

3 REPLIES 3
PaigeMiller
Diamond | Level 26

The easiest solution, which is also the best solution in my opinion, is the leave the data set as one large data set and do not split it.

 

What is your need to have this data split? How would splitting the data set provide benefits? What can you do with split data sets that you can't do with the un-split data set?

--
Paige Miller
Reeza
Super User
Usually it isn't useful to do that in SAS, instead you would create a new variable that indicated the decade and then use BY group processing.


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 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 472 views
  • 0 likes
  • 4 in conversation