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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 780 views
  • 14 likes
  • 3 in conversation