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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 1005 views
  • 1 like
  • 6 in conversation