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: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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
  • 586 views
  • 0 likes
  • 4 in conversation