Вопрос

I have an Excel spreadsheet with company data and descriptions. Some of the cells basically contain mini-essays in them, pages and pages of straight text contained in a single cell. SAS has been giving me problems when I'm importing the file because it truncates some of the longer cells and the text gets cut off mid-sentence. Any ideas on how to avoid this? I've tried saving the file to a tab-delimited text file, but no luck.

Thanks!

Это было полезно?

Решение

Exporting to tab-delimited or csv may be the way to go, as you said. Be sure to have strings enclosed in quotes also. But do you have the length specified for the variable containing the long cells? According to SAS the maximum length is 32,767 characters, so perhaps try as large a number as it takes -- hopefully less than that.

Also the lrecl (max length of each line of the file) should be specified with a max of 32767.

data test;
  length company_name $20 description1 description2 $10000;
  infile my_tab_dlm_file lrecl = 50000 dsd delimiter = '09'x;
  input company_name
        description1
        description2
   ;
run;

Другие советы

If you have a license for SAS/ACCESS (which this link explains how to check). You can use a libname to access the Excel spreadsheet (this link talks about Excel access) and this is a great paper which details how to get at the Excel data just like a SAS data set.

(but @Neil Neyman's answer sounds good too)

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top