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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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