BookmarkSubscribeRSS Feed
LeeSeongWoo_
Fluorite | Level 6


data room1 room2 room3 room4 room5 room6 room7 room8 ;
do i=1 to 8 ;
if rooms = i then output room(i) ;

end ;

run;

 

what should i do if i want to fix room(i) 

 

 

 

7 REPLIES 7
PaigeMiller
Diamond | Level 26

This is not a direct answer to your question, but why do you need eight different data sets? You could keep all the data in one large data set and then do any subsequent processing with a BY statement. It's much simpler.

 

--
Paige Miller
LeeSeongWoo_
Fluorite | Level 6

Thank you for your reply . but the file is too big 

PaigeMiller
Diamond | Level 26

@LeeSeongWoo_ wrote:

Thank you for your reply . but the file is too big 


Too big to do what? How do you know it is too big? Give us information, describe your actual problem instead of avoiding describing the problem.

--
Paige Miller
ballardw
Super User

@LeeSeongWoo_ wrote:

Thank you for your reply . but the file is too big 


What is too big? You don't even reference a data set to read from to split into something smaller.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

As I posted in another thread today, splitting data out into multiple datasets is really not a good idea.

NOw to do what you want, you can't refere to dataset names by using array syntax,so please post an actual example, with test data in the form of a datastep where you would want to use this, as basically all your code below is doing is creating 8 datasets with one row each, which can be achieved by:

data room1 room2...;
run;

As you can see your example makes no sense at all.

 

Astounding
PROC Star

Do you have an existing data set that contains the variable ROOMS?  Right now, there is no data coming in via a SET or INPUT statement.

 

 

Ron_MacroMaven
Lapis Lazuli | Level 10

"The file is *-always-* Too Big!"

 

macro calltext can do this trick.

 

see section 3.3 Splitting a Data Set

 

I agree with others: not a good idea to split a data set into subsets.

Figure out how to use either a by-statement or where clause.

 

Ron Fehd  macro function maven

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
  • 7 replies
  • 2074 views
  • 1 like
  • 6 in conversation