STATA: compress 自动将所有变量转换为其最有效的存储类型以节省内存和磁盘空间

sysuse auto, clear
// (1978 automobile data)
des
//
// Contains data from D:\Stata17\ado\base/a/auto.dta
//  Observations:            74                  1978 automobile data
//     Variables:            12                  13 Apr 2020 17:45
//                                               (_dta has notes)
// --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Variable      Storage   Display    Value
//     name         type    format    label      Variable label
// --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// make            str18   %-18s                 Make and model
// price           int     %8.0gc                Price
// mpg             int     %8.0g                 Mileage (mpg)
// rep78           int     %8.0g                 Repair record 1978
// headroom        float   %6.1f                 Headroom (in.)
// trunk           int     %8.0g                 Trunk space (cu. ft.)
// weight          int     %8.0gc                Weight (lbs.)
// length          int     %8.0g                 Length (in.)
// turn            int     %8.0g                 Turn circle (ft.)
// displacement    int     %8.0g                 Displacement (cu. in.)
// gear_ratio      float   %6.2f                 Gear ratio
// foreign         byte    %8.0g      origin     Car origin
// --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Sorted by: foreign
//自动将所有变量转换为其最有效的存储类型以节省内存和磁盘空间
compress
//   variable mpg was int now byte
//   variable rep78 was int now byte
//   variable trunk was int now byte
//   variable turn was int now byte
//   variable make was str18 now str17
//   (370 bytes saved)
des
//
// Contains data from D:\Stata17\ado\base/a/auto.dta
//  Observations:            74                  1978 automobile data
//     Variables:            12                  13 Apr 2020 17:45
//                                               (_dta has notes)
// --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Variable      Storage   Display    Value
//     name         type    format    label      Variable label
// --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// make            str17   %-17s                 Make and model
// price           int     %8.0gc                Price
// mpg             byte    %8.0g                 Mileage (mpg)
// rep78           byte    %8.0g                 Repair record 1978
// headroom        float   %6.1f                 Headroom (in.)
// trunk           byte    %8.0g                 Trunk space (cu. ft.)
// weight          int     %8.0gc                Weight (lbs.)
// length          int     %8.0g                 Length (in.)
// turn            byte    %8.0g                 Turn circle (ft.)
// displacement    int     %8.0g                 Displacement (cu. in.)
// gear_ratio      float   %6.2f                 Gear ratio
// foreign         byte    %8.0g      origin     Car origin
// --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Sorted by: foreign
//      Note: Dataset has changed since last saved.

 

posted @ 2023-02-26 11:04  myrj  阅读(525)  评论(0编辑  收藏  举报