![]() | ![]() | ![]() | ![]() |
Communications software such as FTP can be used to move SAS data sets and transport files in binary mode. However, you might find the file too large to transfer efficiently. The network might not hold up for the entire process or the transfer might take too long.
This macro can be used to break the data set into smaller data sets at the source host before the transport process. Parameters include the data set name and number of data sets you want to create.
%macro test(dsn,obs);
%let dsid=%sysfunc(open(&dsn));
%let num=%sysfunc(attrn(&dsid,nobs));
%let rc=%sysfunc(close(&dsid));
%let end=%sysevalf(&num/&obs,integer);
%local newobs;
%do i = 1 %to &end;
%if &i = 1 %then %do;
data x&i;
set &dsn(firstobs=&i obs=&obs);
run;
%end;
%else %do;
%if &i ne &end %then %do;
%let newobs=&newobs+&obs;
data x&i;
set &dsn(firstobs=%eval(&newobs+1) obs=%eval(&obs*&i));
run;
%end;
%else %do;
%let newobs=&newobs+&obs;
data x&i;
set &dsn(firstobs=%eval(&newobs+1));
run;
%end;
%end;
%end;
%mend test;
%test(sashelp.class,4)
/* After running the sample, you can uncomment the PROC DATASETS */
/* code below and remove all data sets from the WORK library. */
/*proc datasets lib=work kill memtype=data;*/
/*quit;*/
| Type: | Sample |
| Date Modified: | 2009-06-25 10:23:59 |
| Date Created: | 2009-05-11 19:19:10 |
| Product Family | Product | Host | SAS Release | |
| Starting | Ending | |||
| SAS System | N/A | Microsoft Windows Server 2003 Datacenter 64-bit Edition | ||
| Microsoft® Windows® for 64-Bit Itanium-based Systems | ||||
| Macintosh on x64 | ||||
| Microsoft Windows 2000 Professional | ||||
| Macintosh | ||||
| z/OS | ||||
| OpenVMS VAX | ||||
| Microsoft Windows Server 2003 Enterprise 64-bit Edition | ||||
| Microsoft Windows XP 64-bit Edition | ||||
| Microsoft® Windows® for x64 | ||||
| OS/2 | ||||
| Microsoft Windows 95/98 | ||||
| Microsoft Windows 2000 Advanced Server | ||||
| Microsoft Windows 2000 Datacenter Server | ||||
| Microsoft Windows 2000 Server | ||||
| Microsoft Windows NT Workstation | ||||
| Microsoft Windows Server 2003 Datacenter Edition | ||||
| Microsoft Windows Server 2003 Enterprise Edition | ||||
| Microsoft Windows Server 2003 Standard Edition | ||||
| Microsoft Windows Server 2008 | ||||
| Microsoft Windows XP Professional | ||||
| Windows Millennium Edition (Me) | ||||
| Windows Vista | ||||
| 64-bit Enabled AIX | ||||
| 64-bit Enabled HP-UX | ||||
| 64-bit Enabled Solaris | ||||
| ABI+ for Intel Architecture | ||||
| AIX | ||||
| HP-UX | ||||
| HP-UX IPF | ||||
| IRIX | ||||
| Linux | ||||
| Linux for x64 | ||||
| Linux on Itanium | ||||
| OpenVMS Alpha | ||||
| OpenVMS on HP Integrity | ||||
| Solaris | ||||
| Solaris for x64 | ||||
| Tru64 UNIX | ||||




