03-19-2013 08:46 PM
I am trying to import an excel file using libname on EG. It works fine, I can connect to the file and the using a data step I can just create a table. However, it creates SAS data sets with columns names that do not comply to SAS naming conventions. I get columns with names like 'sample ID 1'. How am I suppose to use these variable names in a SAS code?
I am currently moving from display manager to EG and I am not how to solve this issue.
thanks for your help
03-19-2013 09:17 PM
Those 'sample ID 1' you have mentioned probably are just labels. The actual name is more likely to be 'sample_ID_1'. You can run proc content to confirm or just double click the column name after you have the table opened up.
03-19-2013 10:03 PM
Try the SAS option: options validvarname = V7; It will ensure that your libname translates your Excel columns to SAS columns. The default for EG is validvarname = ANY, which produces the symptoms you are seeing.
03-20-2013 12:45 PM
Thanks for your suggestion. options validvarname = V7 seems to work but it renames the columns _col0,_col1,_col2. I wish it would just replace the blanks with underscore.
I still don't know how I can use a data set where the column name is 'Sample ID 1' ( I checked with proc content and it is actually the variable name). these data sets cannot be opened with SAS base
03-20-2013 01:06 PM
In SAS BASE you then need to specify the options to use the datasets from EG. Then to reference the variable, say sample id 1 you quote it and put an n as I indicated earlier.
sample_id1='Sample ID 1'n;