开发者

Export the types of variables in a SAS dataset

开发者 https://www.devze.com 2023-01-31 18:42 出处:网络
Is there any easy way to capture and export the type of each variable in a SAS dataset? I\'m exporting a dataset to CSV format to read into R, and the read.table procedure in the latter can work more

Is there any easy way to capture and export the type of each variable in a SAS dataset? I'm exporting a dataset to CSV format to read into R, and the read.table procedure in the latter can work more efficiently if it 开发者_JS百科also knows the data type of each variable.


PROC CONTENTS has an OUT= option to ouput a dataset with variable attributes. type=1 is numeric and type=2 is character. HTH.

   proc contents data=sashelp.class out=vars;
   run;

   proc print data=vars noobs;
     var varnum name type length;
   run;
   /* on lst
   VARNUM    NAME      TYPE    LENGTH

      3      Age         1        8
      4      Height      1        8
      1      Name        2        8
      2      Sex         2        1
      5      Weight      1        8
   */
0

精彩评论

暂无评论...
验证码 换一张
取 消