04-29-2014 01:47 PM
I have a .xlsx spreadsheet that I am trying to import using Enterprise Guide. I select the data source in Step 1 of the Import Wizard, then, in Step 2, I make sure that both "First row of range contains field names" and "Rename columns to comply with SAS naming conventions" are checked. Then, in Step 3, "Define Field Attributes", all of the values in the "Name" column (except those that didn't contain a space in the source) are being set to something like 'Column Name'n, instead of Column_Name, which is what I would expect. If I copy any header cell from the source and paste it into Notepad, I see that each column header has a line break at the end. I tried trimming them using excel's trim(), but the line break seems to be added in again. Also, it's odd that this problem only arises for those column headers that contain a space character in the source. I have a column in the source called PID. If I copy it into notepad, I still see the line return character, but SAS EG imports it and names it properly.
I'd appreciate any help you all can provide. I'm using Enterprise Guide 126.96.36.19925 on a 64-bit Windows 7 machine with Microsoft Excel 2010.
04-29-2014 02:04 PM
Thanks for the response, Reeza. I did that but it didn't seem to work. I read elsewhere about your solution, and the directions noted there mentioned going into Tools > Options > Tasks General and specifying the validvarname there, but either my version of EG is too old or too new, because I see no additional SAS code section there. Anyway, thanks again. For now, I'm just going through my 80 or so columns and renaming them manually in Step 3. I swear the import worked just fine less than a week ago, so maybe something in my environment has changed recently.
04-29-2014 02:24 PM
For anyone who is interested, although the original problem still exists, I used this simple workaround to avoid having to modify each variable name manually in the Import Wizard.
1. Create a new row under the first row in the spreadsheet (which contains your variable names)
2. Use =substitute("A1"," ","_") in the cell below each cell in the original variable names row
3. Copy this newly created row and Paste Special > Values right over what you just copied.
4. Delete the original column headers, save the workbook, and go do the import in Enterprise Guide.
This works fine for me, as I assume Enterprise Guides sees the incoming variable names as already being SAS-compliant, so it doesn't try to perform it's own modifications on the variable names.
04-29-2014 02:34 PM
This is a new behavior in 6.1. 5.1 Added underscores for us. I had many 5.1 projects break because of it. I reported it to Chris Hemendinger at the Global Forum and he suggested that I submit it as an issue to the EG team. I haven't gotten around to that yet. In the meantime, I just manually added underscores in my import tasks...