BookmarkSubscribeRSS Feed
ybz12003
Rhodochrosite | Level 12

Hello,

 

I use proc dataset to format my SAS dataset.    I would like to save my new SAS dataset into a new file, please advise how to do it.  Thanks.

 

proc datasets library=work; 
				 modify test;
				format  ID   $9.   
.
.
.
.
.
.
run;
5 REPLIES 5
andreas_lds
Jade | Level 19

You will have to copy the dataset before adding the formats. The modify-statement has no option to store the dataset with a new name.

ybz12003
Rhodochrosite | Level 12

Of course using DATA step could approach this format purpose.   However, I have hundreds of statement (format, rename and label) to modify this dataset.   I read use proc dataset could reduce the processing time, comparing with simple data step.   That is why I use Proc Dataset.   Correct me if I am wrong.

andreas_lds
Jade | Level 19

@ybz12003 wrote:

Of course using DATA step could approach this format purpose.   However, I have hundreds of statement (format, rename and label) to modify this dataset.   I read use proc dataset could reduce the processing time, comparing with simple data step.   That is why I use Proc Dataset.   Correct me if I am wrong.


That is correct as long as you don't need the modifications applied to a clone of the dataset.

Kurt_Bremser
Super User

@ybz12003 wrote:

Of course using DATA step could approach this format purpose.   However, I have hundreds of statement (format, rename and label) to modify this dataset.   I read use proc dataset could reduce the processing time, comparing with simple data step.   That is why I use Proc Dataset.   Correct me if I am wrong.


Quote from your otriginal post:

"I would like to save my new SAS dataset into a new file"

Since you read and write the dataset anyway, the advantages of using proc datasets won't come into play.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 5 replies
  • 1250 views
  • 2 likes
  • 3 in conversation