sasdirectorydatasetpermanent

permanently save modified dataset


I know this is a very basic question but my code keeps failing when trying to run what I found through the help documentation.

Up to now I have been running an analysis project off of the .WORK directory which I understand gets wiped out every time a session ends. I have done a bunch of data cleaning and preparation and do not want to have to do that every time before I start my analysis.

So I understand, from reading this: https://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/viewer.htm#a001310720.htm that I have to output the cleaned dataset to a non-temporary directory.

Steps I have taken so far: 1) created a new Library called "Project" 2) Saved it in a folder that I have under "my folders" in SAS 3) My code for saving the cleaned dataset to the "Project" library is as follows:

PROC SORT DATA=FAA_ALL NODUPKEY;
BY GROUND_SPEED;
DATA PROJECT.FAA_ALL;
RUN;

Then I run this code in a new program:

PROC PRINT DATA=PROJECT.FAA_ALL;
RUN;

It says there are no observations and that the dataset is essentially empty.

Can some tell me where I'm going wrong?


Solution

  • Your problem is the PROC SORT

    PROC SORT DATA=FAA_ALL NODUPKEY;
    BY GROUND_SPEED;
    DATA PROJECT.FAA_ALL;
    RUN;
    

    Should be

    PROC SORT DATA=FAA_ALL OUT= PROJECT.FAA_ALL NODUPKEY;
    BY GROUND_SPEED;
    RUN;
    

    That DATA PROJECT.FAA_ALL was starting a Data Step creating a blank data set.