BookmarkSubscribeRSS Feed
BrahmanandaRao
Lapis Lazuli | Level 10
data split_obs;
input name $ city$ ;
datalines;
A   mumbai
B   chennai
C   pune
D   chennai
F   mumbai
;
run;

i want split observations as single dataset with name 

like A dataset with  name and city 

3 REPLIES 3
PeterClemmensen
Tourmaline | Level 20

So you want 5 separate data sets from this 1 data set? Also, what if more than one observation had the same name? And same Name and City? Like below

 

data split_obs;
input name $ city$ ;
datalines;
A   mumbai  
A   mumbai  
A   pune    
B   chennai 
C   pune    
D   chennai 
F   mumbai  
;
run;
BrahmanandaRao
Lapis Lazuli | Level 10

I want those observations separated with single observation with cityname of the dataset

ex data_mumbai      contains  Name     City

                                          A         mumbai 

 

 

like that

PaigeMiller
Diamond | Level 26

Why? Having data as single lines in many data sets makes your programming harder.

--
Paige Miller

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 966 views
  • 1 like
  • 3 in conversation