Showing posts with label Proc copy. Show all posts
Showing posts with label Proc copy. Show all posts

SAS Default Sample Data Sets Library With Proc Datasets procedure

Some useful codes for Proc datasets procedure:-

1. To get the default SAS Datasets or Sample library :

 Proc datasets library = Sampsio;

run;



2. To copy an entire library to a specific destination in SAS :

Proc datasets library = Source;

Copy out = Destination;

run;



3. To copy a dataset from one library to another library in SAS :

Proc Copy in = Practice  out = Production;

select DSN;

Run;

* Dataset DSN has been copied to Production library from practice library.



4. Using Datasets Procedure to modify the variable name of existing dataset:

Proc Datasets library = Practice;

Modify DSN;

Rename Emp=Employee;

Quit;

* Variable name EMP has been modified as Employee from Practice library.



5. To delete as SAS library:

Proc Datasets library = Libraryname Kill;

Quit;

* kill option deletes all the members from the library.



6. To delete a SAS Dataset from a SAS library:

Proc Datasets library = Libraryname  nolist;

Delete DSN;

Quit;

* Dataset DSN has been deleted. Nolist option to suppress the printing of the directory of SAS files in the SAS log or ODS output.



7. To change the name of a SAS Dataset:

Proc Datasets library = Practice nolist;

Change Learn=Earn;

Quit;

* Data set Learn has been renamed as Earn.