Master SAS in 30 days!

A jargon-free, easy-to-learn SAS base course that is tailor-made for students with no prior knowledge of SAS.

Lesson 2.4: Saving a dataset into a Windows directory

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.

Example

LIBNAME SASLib “/folders/myfolders”;

DATA Work_Example;
    a = 1;
run;

DATA SASLib.SASCrunch;
    set Work_Example;
run;

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!

Master SAS in 30 Days

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
iconmail

Get latest articles from SASCrunch

SAS Base Certification Exam Prep Course

Two Certificate Prep Courses and 300+ Practice Exercises