Similar to reading-in the dataset from a Windows directory, we can reverse the process and save the dataset into a hard drive folder via library.
LIBNAME SASLib “/folders/myfolders”;
a = 1;
Supposedly, we want to save this ‘Work_Example’ dataset (2) into the Windows directory ‘/folders/myfolders’ (so that I can later send this file to my friend, John, via email).
Step 1: Create a library that connects directly to ‘/folders/myfolders‘ ( see (1) above ).
Step 2: Create the dataset with the corresponding library reference ( see (3) above ).
In our example, the dataset ‘SASCrunch’ is created with the library reference of ‘SASLib’. As a result, SAS will save this dataset in the SASLib library.
Again, SASLib is directly connected to the ‘/folders/myfolders‘ folder. The ‘SASCrunch’ dataset saved under there is also saved into the corresponding Windows directory!
DONE! You have learned how to save a SAS dataset into a Windows directory!