楼主: edwardzxf
6217 13

获取数据集的大小 [推广有奖]

11
tangliang0905 发表于 2013-9-24 01:14:16
pobel 发表于 2013-9-22 14:34
*** Size;
filename test  pipe 'dir "C:\Program Files\SAS\SAS 9.1\core\sashelp" ';
data test1;
为什么size和size on disk不是一个概念啊?因为两个filesize的值不一样,第一个size是直接在属性里面看到的文件大小,大概是5k多,那么第二个呢?

12
pobel 在职认证  发表于 2013-9-24 08:12:33
edwardzxf 发表于 2013-9-23 22:09
假设我要知道work.data这个数据集的大小,那应该如何呢?
data data;
   set sashelp.company;
run;


*** Size;
%let workpath=%sysfunc(pathname(work));
%let search=data.sas7bdat;

filename test  pipe "dir ""&workpath"" ";
data test1;
   infile test lrecl=300 truncover;
   input @1 tmp $100.;
   ind=index(tmp, "&search");
   if ind>0;
   start=index(tmp,"    ");
  
   size=strip(substr(tmp,start,ind-start));
   put size=;
run;


*** Size on Disk;
data test2;
   set sashelp.vtable;
   where libname="WORK" and memname="DATA";
   put filesize=;
run;
和谐拯救危机

13
pobel 在职认证  发表于 2013-9-24 08:19:43
tangliang0905 发表于 2013-9-24 01:14
为什么size和size on disk不是一个概念啊?因为两个filesize的值不一样,第一个size是直接在属性里面看到 ...
从网上搜来的:
“Size is the actual size of the file in bytes.
size on disk is the actual amount of space being take up on the disk. the disk is broken down into tracks and sectors.
So, if your sectors size is 512 bytes and your file is actually 513 bytes, the size on disk will be 1024bytes because it is occupying two sectors.”

和谐拯救危机

14
edwardzxf 学生认证  发表于 2013-9-24 11:16:35
pobel 发表于 2013-9-24 08:19
从网上搜来的:
“Size is the actual size of the file in bytes.
size on disk is the actual amount ...
Many many thanks...

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-27 03:13