Amy Jack
Amy Jack

Reputation: 65

Exporting Data from sas into CSV file

I am trying to download a file from SAS and import it to Hadoop. Its a huge dataset - 6GB. When I export the sas dataset to csv file and then import back to sas.(as I was facing few in issues in hadoop, I tried importing back to SAS and verify values). The import shows problems in the dataset in the same tool itself.. The column values are jumbled up. Few columns have junk values, few columns are overlapped How can I export the dataset in csv format with the column values intact.

filename output 'AAA.csv' encoding="utf-8";


Proc export data= input_data
            outfile= output
            dbms = CSV;
run;

Upvotes: 0

Views: 3077

Answers (1)

Tom
Tom

Reputation: 51566

Just a guess, but try removing any end of line characters that might exist in your character strings.

For example you could use a simple data step view to convert the strings on the fly. Here is one that replaces any CR or LF character with a pipe character.

data for_export / view=for_export;
  set input_data;
  array _c _character_;
  do over _c;
    _c = translate(_c,'||','0D0A'x);
  end;
run;
proc export data=for_export outfile=output dbms=CSV;
run;

You might also watch out for backslash characters. Some readers try to interpret those as an escape character.

Upvotes: 1

Related Questions