0
votes

[csv file for import][1]

[Here,I am trying to import csv file with 5 columns as shown in the image by using PROC Import in SAS. And my approach is to update column names post log is generated.But the log is showing that SAS is recognizing only two fully filled columns and not the other three.Also ,in the dataset that is created,it is very messy due to vales of column B spread all across it.

Character of other three columns not recognized are as follows :

1) column B ,contains multiple inputs per cell as shown in the image.In excel such entries per column are performed by doing ALT+Enter. 2) column C is names ,it is sparsely populated. 3) column D is placeholder column and hence not populated yet.

1
Your images don't come through. Please add sample of the csv file and your code and log, as text, in the question.Quentin

1 Answers

0
votes

If you made the file with Excel then try using TERMSTR=CRLF on the infile defintion so that the embedded CR do not get treated as starting new lines. If you only have 5 columns then just skip PROC IMPORT and write your own DATA step to read the file. Then you won't need to rename the columns, just use the column names you want in your DATA step.

data want ;
  infile 'myfile.csv' dsd firstobs=2 truncover termstr=crlf ;
  length var1 -var5 $50 ;
  input var1-var5;
run;