How to merge multiple csv files into single dataset using SAS

前端 未结 2 1157
庸人自扰
庸人自扰 2021-01-16 00:09

I have ~2300 CSV files and colunm 1 variable name is different for each CSV file. I want to merge all files by panelistID (colunm 2) and run frequencies on column 1 to get f

2条回答
  •  無奈伤痛
    2021-01-16 00:45

    Simply use a wildcard on the infile statement to read in all the files, and the filename= option to store the current file in a temporary variable _f, storing it into f.

    Then manipulate f and var accordingly.

    data big ;
      length _f f $256. ;
      infile "*.csv" truncover filename=_f dlm=',' ;
      f = _f ;
      input var
            panellistID
            ;
    run ;
    

提交回复
热议问题