BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
anamaria2
Calcite | Level 5

Iam reading an excel file using OnDemand. I tried both my own code and the right clicking option. Some of the variables names have spaces/#/- characters in the names, which we would expect SAS to convert to underscore.

 

PROC IMPORT DATAFILE="/home/....../raw data.xlsx"
OUT=WORK.MYdata
DBMS=XLSX
REPLACE;
GETNAMES=YES;
RUN;

 

The log says everything went ok:

 
NOTE: The import data set has 75 observations and 31 variables.
NOTE: WORK.MYdata data set was successfully created.
 
However, this is how PROC CONTENTS looks like:
 
GroupNum8BEST.Group
PlateNum8BEST.Plate
CohortNum8BEST.Cohort
Dam IDNum8BEST.Dam ID
Infant IDNum8BEST.Infant ID
DayNum8BEST.Day
GM-CSFNum8BEST.GM-CSF
IFN-gNum8BEST.IFN-g
IL-1bNum8BEST.IL-1b
IL-raNum8BEST.IL-ra

 

I did not get any of the usual messages about SAS converting IFN-g to IFN_g, etc...
Also running the exact same code in the licensed version produces this (which is what we would expect):

GroupNum8BEST.Group
PlateNum8BEST.Plate
CohortNum8BEST.Cohort
Dam_IDNum8BEST.Dam ID
Infant_IDNum8BEST.Infant ID
DayNum8BEST.Day
GM_CSFNum8BEST.GM-CSF
IFN_gNum8BEST.IFN-g
IL_1bNum8BEST.IL-1b
IL_raNum8BEST.IL-ra

 

I an not sure what to try anymore. Why isn't SAS OnDemand giving me exactly the same result as the licensed version? (I ended up creating a SAS file in the licensed version and reading that file in the OnDemand, but I would like to be able to just import the xlsx file). Does anybody have any suggestions? I am attaching an abbreviated data set.Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
tom_grant
SAS Super FREQ

You can also set this option by select the More Options Icon on top right & then selecting preferences, select Tables from the list  & set SAS variable name policy to V7.

tom_grant_0-1635947296209.png

 

View solution in original post

4 REPLIES 4
Reeza
Super User
OPTIONS VALIDVARNAME=V7;

The default in Studio and EG is VALIDVARNAME=ANY which is a bit more modern but a pain to deal with when programming.
Add the option to your AUTOEXEC in Studio and forget about it 🙂
tom_grant
SAS Super FREQ

You can also set this option by select the More Options Icon on top right & then selecting preferences, select Tables from the list  & set SAS variable name policy to V7.

tom_grant_0-1635947296209.png

 

anamaria2
Calcite | Level 5

Thank you so much for your help. 

Worked perfectly. 

ana-maria