DATA Step, Macro, Functions and more

import and export sas dataset

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 129
Accepted Solution

import and export sas dataset

How to save SAS Dataset in a c drive and acess it.

 

A) save dataset

here is something I've used to save excel file. how will it work for sas dataset

 

%let YYYYMM = 201703;

 

data _null_;
file cmds;
put "[save.as(%bquote("C:\Program Files\output\DataSet &YYYYMM..xlsx"))]";
put '[CLOSE()]';
run;

 

B) import dataset

can you please advise how to import dataset in a sas program

 

Thanks


Accepted Solutions
Solution
‎05-12-2017 06:31 PM
Super User
Posts: 6,939

Re: import and export sas dataset

A SAS dataset is stored in a library; a library definition (libname statement) connects a logical SAS library name with a physical path to an existing directory.

You do not "import" a SAS dataset into SAS. Datasets are read with proc sql ("from") or with the set or merge statements in a data step, or by naming them in the data= option in a procedure statement.

 

There are several ways to move SAS data to other applications; which one should be used has to be determined according to the external application and what exactly (just data, or whole reports) needs to be exported.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers

View solution in original post


All Replies
Solution
‎05-12-2017 06:31 PM
Super User
Posts: 6,939

Re: import and export sas dataset

A SAS dataset is stored in a library; a library definition (libname statement) connects a logical SAS library name with a physical path to an existing directory.

You do not "import" a SAS dataset into SAS. Datasets are read with proc sql ("from") or with the set or merge statements in a data step, or by naming them in the data= option in a procedure statement.

 

There are several ways to move SAS data to other applications; which one should be used has to be determined according to the external application and what exactly (just data, or whole reports) needs to be exported.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 108 views
  • 0 likes
  • 2 in conversation