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;
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.
Do both (creation of a new dataset and assigning the format) in a simple data step.
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.
@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.
@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.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.