Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to save a modified data set on SAS?

I’m new to SAS and was wondering how to save a modified data set on SAS. On my SAS enterprise, there is a dataset called cars on sashelp. I modified the dataset to print only those cars which are from "Acura".

proc print data = sashelp.cars;
Where Make="Acura";
run;

Now how do I save this modified data set on my WORK library so that I can retrieve it from there and merge it with other data sets and do some more interesting stuff with it. I tried looking for how to do this on Google but wasn’t able to find a solution. Would appreciate some help. Thanks.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

For purposes of saving SAS data sets, there are two key elements to the below code:

  • a data statement which instructs SAS where to write the file and what to name it: data <library>.<table>. In this case, no library is specified so it will be written to the (default) work library. The table will be named want.
  • a set statement which tells you to read the cars table in the sashelp library. One can use the where data option to subset the initial table.
data want;
set sashelp.cars(where=(make="Acura"));
run;
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading