The Excel engine uses Microsoft Jet or Ace, whereas the xlsx engine uses a proprietary system that does not have as much control as Microsoft's. The reason why the problem is occurring is because the xlsx engine in proc import is internal to SAS, and is separate from the Excel engine. For example: libname myxlsx Excel 'C:\rawdata.xlsx' If you do have SAS/Access to Excel, you can control these variables directly with the DBDSOPTS data set option. If that doesn't work, unless you use PC Files Server, or have Excel of the same bitness installed on the same SAS server for direct access to the file, you will need to use a separate data step to convert the columns. You can try to set the columns type as "Text" in Excel to see if SAS will determine it from that. I dislike the second because it may unintentionally introduce errors (again, such as with leading zeros) and introduces extraneous work. I dislike the first solution because it requires me to manually manipulate the data, a potential source of error (such as leading zeros being removed). csv and use INFILE in a DATA step and 2) bring the data in as numeric and convert it to character in a later step. Two possible solutions I can think of are 1) convert. I am using PROC IMPORT because it has yielded the greatest success with. INFORMAT, LENGTH, and INPUT statements do not seem to work for PROC IMPORT. I cannot find documentation which explains how to do this. I want to be able to control it manually. What this seems to tell me is that SAS automatically assigns the variable type. When I run this step, I get the following log output:ĮRROR: You are trying to use the character format $ with the numeric variable ID2 in data set WORK.RAWDATA. The procedure I am running is: proc import out=rawdata My data looks like this: ID1 ID2 MONTH YEAR QTR VAR1 VAR2 Questions: How do I define the variable type of variables being imported from a.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |