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.


Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 440 views
  • 0 likes
  • 4 in conversation