BookmarkSubscribeRSS Feed
kwu
SAS Employee kwu
SAS Employee
I am trying to partition a input table and only want to go through the input table only once and based on the partition key to output to the table.
I wonder if it is possible to output obs to a dynamic dataset name.

what I plan to do is to sort the input dataset by the partition key variable, then output to a new dataset when a new partitionkey is detected. however, I could not find a way to specify a output dataset name dynamically.

any suggestion would be appreciated.
5 REPLIES 5
Patrick
Opal | Level 21
Hi
I would say this can't be done with one pass through the data as the output data sets are defined during compilation time but you only know how many and which names of data sets you need during execution time.

A possible approach would be to add a data _null_ step creating the SAS syntax you need, write this syntax to a temporay file and then %include this file after the data _null_ step to get it executed.

HTH
Patrick
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Using the DATA step and HASH technique, you have the OUTPUT() method that can dynamically create SAS files.

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search argument, this topic / post:
hash output method documentation site:sas.com
Patrick
Opal | Level 21
Beautyful!
I didn't realise this possibility of hash object usage so far.

Thanks a lot, Scott!
kwu
SAS Employee kwu
SAS Employee
Your guys are rock!!!
Thank you all very much indeed.

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
  • 5 replies
  • 2919 views
  • 0 likes
  • 4 in conversation